r-gregmisc-users Mailing List for R gregmisc package (Page 8)
Brought to you by:
warnes
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(12) |
Apr
(5) |
May
(3) |
Jun
(5) |
Jul
(2) |
Aug
(5) |
Sep
(7) |
Oct
(15) |
Nov
(34) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(3) |
Feb
(16) |
Mar
(28) |
Apr
(5) |
May
|
Jun
(5) |
Jul
(9) |
Aug
(50) |
Sep
(29) |
Oct
(9) |
Nov
(25) |
Dec
(7) |
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(8) |
May
(26) |
Jun
(11) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
(26) |
Jun
|
Jul
(10) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(3) |
Dec
(2) |
2010 |
Jan
(45) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(8) |
Jun
(7) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(9) |
Dec
(1) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(14) |
Sep
(29) |
Oct
(3) |
Nov
|
Dec
(3) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
(59) |
Jul
|
Aug
(8) |
Sep
(21) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
(10) |
Apr
|
May
(18) |
Jun
(25) |
Jul
(18) |
Aug
(1) |
Sep
(6) |
Oct
(28) |
Nov
(4) |
Dec
(13) |
2014 |
Jan
(7) |
Feb
(5) |
Mar
(4) |
Apr
(36) |
May
(3) |
Jun
(7) |
Jul
(46) |
Aug
(14) |
Sep
(12) |
Oct
(2) |
Nov
|
Dec
(12) |
2015 |
Jan
(4) |
Feb
|
Mar
|
Apr
(80) |
May
(36) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <wa...@us...> - 2014-07-21 13:38:25
|
Revision: 1851 http://sourceforge.net/p/r-gregmisc/code/1851 Author: warnes Date: 2014-07-21 13:38:15 +0000 (Mon, 21 Jul 2014) Log Message: ----------- - Return to using get_IBM_double, but add reverse_double before the call if running on BIGENDIAN machine. Modified Paths: -------------- trunk/SASxport/src/SASxport.c Modified: trunk/SASxport/src/SASxport.c =================================================================== --- trunk/SASxport/src/SASxport.c 2014-07-20 02:17:21 UTC (rev 1850) +++ trunk/SASxport/src/SASxport.c 2014-07-21 13:38:15 UTC (rev 1851) @@ -39,16 +39,16 @@ #define HEADER_END "HEADER RECORD!!!!!!!000000000000000000000000000000 " #define LIB_HEADER HEADER_BEG HEADER_TYPE_LIBRARY HEADER_END -#define MEM_HEADER HEADER_BEG HEADER_TYPE_MEMBER \ +#define MEM_HEADER HEADER_BEG HEADER_TYPE_MEMBER \ "HEADER RECORD!!!!!!!000000000000000001600000000" #define DSC_HEADER HEADER_BEG HEADER_TYPE_DSCRPTR HEADER_END -#define NAM_HEADER HEADER_BEG HEADER_TYPE_NAMESTR \ +#define NAM_HEADER HEADER_BEG HEADER_TYPE_NAMESTR \ "HEADER RECORD!!!!!!!000000" #define OBS_HEADER HEADER_BEG HEADER_TYPE_OBS HEADER_END #define BLANK24 " " -#define GET_RECORD(rec, fp, len) \ - (int) fread((rec), sizeof(char), (size_t) (len), (fp)) +#define GET_RECORD(rec, fp, len) \ + (int) fread((rec), sizeof(char), (size_t) (len), (fp)) #define IS_SASNA_CHAR(c) ((c) == 0x5f || (c) == 0x2e || \ (0x41 <= (c) && (c) <= 0x5a)) @@ -62,232 +62,232 @@ static double get_IBM_double(char* c, size_t len) { -/* Conversion from IBM 360 format to double */ -/* - * IBM format: - * 6 5 0 - * 3 1 0 - * - * SEEEEEEEMMMM ......... MMMM - * - * Sign bit, 7 bit exponent, 56 bit fraction. Exponent is - * excess 64. The fraction is multiplied by a power of 16 of - * the actual exponent. Normalized floating point numbers are - * represented with the radix point immediately to the left of - * the high order hex fraction digit. - */ - unsigned int i, upper, lower; - /* exponent is expressed here as - excess 70 (=64+6) to accomodate - integer conversion of c[1] to c[4] */ - char negative = c[0] & 0x80; - // needs to be signed: char is not on Raspbian - signed char exponent = (c[0] & 0x7f) - 70; - double value; - char buf[4], ibuf[8]; + /* Conversion from IBM 360 format to double */ + /* + * IBM format: + * 6 5 0 + * 3 1 0 + * + * SEEEEEEEMMMM ......... MMMM + * + * Sign bit, 7 bit exponent, 56 bit fraction. Exponent is + * excess 64. The fraction is multiplied by a power of 16 of + * the actual exponent. Normalized floating point numbers are + * represented with the radix point immediately to the left of + * the high order hex fraction digit. + */ + unsigned int i, upper, lower; + /* exponent is expressed here as + excess 70 (=64+6) to accomodate + integer conversion of c[1] to c[4] */ + char negative = c[0] & 0x80; + // needs to be signed: char is not on Raspbian + signed char exponent = (c[0] & 0x7f) - 70; + double value; + char buf[4], ibuf[8]; - if (len < 2 || len > 8) - error(_("invalid field length in numeric variable")); + if (len < 2 || len > 8) + error(_("invalid field length in numeric variable")); - /* this effectively zero-pads c: */ - memset(ibuf, 0, (size_t) 8); - memcpy(ibuf, c, len); - c = ibuf; - /* check for missing value */ - /* This isn't really right: NAs are ' ', '.', A-Z plus zero fill */ - if (c[1] == '\0' && c[0] != '\0') return R_NaReal; - /* convert c[1] to c[3] to an int */ - buf[0] = '\0'; - for (i = 1; i < 4; i++) buf[i] = c[i]; - char_to_uint(buf, upper); - /* convert c[4] to c[7] to an int */ - for (i = 0; i < 4; i++) buf[i] = c[i + 4]; - char_to_uint(buf, lower); - /* initialize the constant if needed */ - value = ((double) upper + ((double) lower)/Two32) * - pow(16., (double) exponent); - if (negative) value = -value; - return value; + /* this effectively zero-pads c: */ + memset(ibuf, 0, (size_t) 8); + memcpy(ibuf, c, len); + c = ibuf; + /* check for missing value */ + /* This isn't really right: NAs are ' ', '.', A-Z plus zero fill */ + if (c[1] == '\0' && c[0] != '\0') return R_NaReal; + /* convert c[1] to c[3] to an int */ + buf[0] = '\0'; + for (i = 1; i < 4; i++) buf[i] = c[i]; + char_to_uint(buf, upper); + /* convert c[4] to c[7] to an int */ + for (i = 0; i < 4; i++) buf[i] = c[i + 4]; + char_to_uint(buf, lower); + /* initialize the constant if needed */ + value = ((double) upper + ((double) lower)/Two32) * + pow(16., (double) exponent); + if (negative) value = -value; + return value; } static int get_nam_header(FILE *fp, struct SAS_XPORT_namestr *namestr, int length) { - char record[141]; - int n; + char record[141]; + int n; - record[length] = '\0'; - n = GET_RECORD(record, fp, length); - if(n != length) - return 0; + record[length] = '\0'; + n = GET_RECORD(record, fp, length); + if(n != length) + return 0; - char_to_short(record, namestr->ntype); - char_to_short(record+2, namestr->nhfun); - char_to_short(record+4, namestr->nlng); - char_to_short(record+6, namestr->nvar0); - memcpy(namestr->nname, record + 8, 8); - memcpy(namestr->nlabel, record + 16, 40); - memcpy(namestr->nform, record + 56, 8); - char_to_short(record+64, namestr->nfl); - char_to_short(record+66, namestr->nfd); - char_to_short(record+68, namestr->nfj); - memcpy(namestr->nfill, record + 70, 2); - memcpy(namestr->niform, record + 72, 8); - char_to_short(record+80, namestr->nifl); - char_to_short(record+82, namestr->nifd); - char_to_int(record+84, namestr->npos); - return 1; + char_to_short(record, namestr->ntype); + char_to_short(record+2, namestr->nhfun); + char_to_short(record+4, namestr->nlng); + char_to_short(record+6, namestr->nvar0); + memcpy(namestr->nname, record + 8, 8); + memcpy(namestr->nlabel, record + 16, 40); + memcpy(namestr->nform, record + 56, 8); + char_to_short(record+64, namestr->nfl); + char_to_short(record+66, namestr->nfd); + char_to_short(record+68, namestr->nfj); + memcpy(namestr->nfill, record + 70, 2); + memcpy(namestr->niform, record + 72, 8); + char_to_short(record+80, namestr->nifl); + char_to_short(record+82, namestr->nifd); + char_to_int(record+84, namestr->npos); + return 1; } static int get_lib_header(FILE *fp, struct SAS_XPORT_header *head) { - char record[81]; - int n; + char record[81]; + int n; - n = GET_RECORD(record, fp, 80); - if(n != 80 || strncmp(LIB_HEADER, record, 80) != 0) - error(_("file not in SAS transfer format")); + n = GET_RECORD(record, fp, 80); + if(n != 80 || strncmp(LIB_HEADER, record, 80) != 0) + error(_("file not in SAS transfer format")); - n = GET_RECORD(record, fp, 80); - if(n != 80) - return 0; - record[80] = '\0'; - memcpy(head->sas_symbol[0], record, 8); - memcpy(head->sas_symbol[1], record+8, 8); - memcpy(head->saslib, record+16, 8); - memcpy(head->sasver, record+24, 8); - memcpy(head->sas_os, record+32, 8); - if((strrchr(record+40, ' ') - record) != 63) - return 0; - memcpy(head->sas_create, record+64, 16); + n = GET_RECORD(record, fp, 80); + if(n != 80) + return 0; + record[80] = '\0'; + memcpy(head->sas_symbol[0], record, 8); + memcpy(head->sas_symbol[1], record+8, 8); + memcpy(head->saslib, record+16, 8); + memcpy(head->sasver, record+24, 8); + memcpy(head->sas_os, record+32, 8); + if((strrchr(record+40, ' ') - record) != 63) + return 0; + memcpy(head->sas_create, record+64, 16); - n = GET_RECORD(record, fp, 80); - if(n != 80) - return 0; - record[80] = '\0'; - memcpy(head->sas_mod, record, 16); - if((strrchr(record+16, ' ') - record) != 79) - return 0; - return 1; + n = GET_RECORD(record, fp, 80); + if(n != 80) + return 0; + record[80] = '\0'; + memcpy(head->sas_mod, record, 16); + if((strrchr(record+16, ' ') - record) != 79) + return 0; + return 1; } static int get_mem_header(FILE *fp, struct SAS_XPORT_member *member) { - char record[81]; - int n; + char record[81]; + int n; - n = GET_RECORD(record, fp, 80); - if(n != 80 || strncmp(DSC_HEADER, record, 80) != 0) - error(_("file not in SAS transfer format")); + n = GET_RECORD(record, fp, 80); + if(n != 80 || strncmp(DSC_HEADER, record, 80) != 0) + error(_("file not in SAS transfer format")); - n = GET_RECORD(record, fp, 80); - if(n != 80) - return 0; - record[80] = '\0'; - memcpy(member->sas_symbol, record, 8); - memcpy(member->sas_dsname, record+8, 8); - memcpy(member->sasdata, record+16, 8); - memcpy(member->sasver, record+24, 8); - memcpy(member->sas_osname, record+32, 8); - if((strrchr(record+40, ' ') - record) != 63) - return 0; - memcpy(member->sas_create, record+64, 16); + n = GET_RECORD(record, fp, 80); + if(n != 80) + return 0; + record[80] = '\0'; + memcpy(member->sas_symbol, record, 8); + memcpy(member->sas_dsname, record+8, 8); + memcpy(member->sasdata, record+16, 8); + memcpy(member->sasver, record+24, 8); + memcpy(member->sas_osname, record+32, 8); + if((strrchr(record+40, ' ') - record) != 63) + return 0; + memcpy(member->sas_create, record+64, 16); - n = GET_RECORD(record, fp, 80); - if(n != 80) - return 0; - record[80] = '\0'; - memcpy(member->sas_mod, record, 16); + n = GET_RECORD(record, fp, 80); + if(n != 80) + return 0; + record[80] = '\0'; + memcpy(member->sas_mod, record, 16); - memcpy(member->sas_dslabel, record+32, 40); - memcpy(member->sas_dstype, record+72, 8); + memcpy(member->sas_dslabel, record+32, 40); + memcpy(member->sas_dstype, record+72, 8); - return 1; + return 1; } static int init_xport_info(FILE *fp) { - char record[81]; - int n; - int namestr_length; + char record[81]; + int n; + int namestr_length; - struct SAS_XPORT_header *lib_head; + struct SAS_XPORT_header *lib_head; - lib_head = Calloc(1, struct SAS_XPORT_header); + lib_head = Calloc(1, struct SAS_XPORT_header); - if(!get_lib_header(fp, lib_head)) { - Free(lib_head); - error(_("SAS transfer file has incorrect library header")); - } - + if(!get_lib_header(fp, lib_head)) { Free(lib_head); + error(_("SAS transfer file has incorrect library header")); + } - n = GET_RECORD(record, fp, 80); - if(n != 80 || - strncmp(MEM_HEADER, record, 75) != 0 || - strncmp(" ", record+78, 2) != 0 ) - error(_("file not in SAS transfer format")); - record[78] = '\0'; - sscanf(record+75, "%d", &namestr_length); + Free(lib_head); - return namestr_length; + n = GET_RECORD(record, fp, 80); + if(n != 80 || + strncmp(MEM_HEADER, record, 75) != 0 || + strncmp(" ", record+78, 2) != 0 ) + error(_("file not in SAS transfer format")); + record[78] = '\0'; + sscanf(record+75, "%d", &namestr_length); + + return namestr_length; } static int init_mem_info(FILE *fp, char *name, char *dslabel, char *dstype) { - int length, n; - char record[81]; - char *tmp; - struct SAS_XPORT_member *mem_head; + int length, n; + char record[81]; + char *tmp; + struct SAS_XPORT_member *mem_head; - mem_head = Calloc(1, struct SAS_XPORT_member); - if(!get_mem_header(fp, mem_head)) { - Free(mem_head); - error(_("SAS transfer file has incorrect member header")); - } + mem_head = Calloc(1, struct SAS_XPORT_member); + if(!get_mem_header(fp, mem_head)) { + Free(mem_head); + error(_("SAS transfer file has incorrect member header")); + } - n = GET_RECORD(record, fp, 80); - record[80] = '\0'; - if(n != 80 || strncmp(NAM_HEADER, record, 54) != 0 || - (strrchr(record+58, ' ') - record) != 79) { - Free(mem_head); - error(_("file not in SAS transfer format")); - } - record[58] = '\0'; - sscanf(record+54, "%d", &length); + n = GET_RECORD(record, fp, 80); + record[80] = '\0'; + if(n != 80 || strncmp(NAM_HEADER, record, 54) != 0 || + (strrchr(record+58, ' ') - record) != 79) { + Free(mem_head); + error(_("file not in SAS transfer format")); + } + record[58] = '\0'; + sscanf(record+54, "%d", &length); - tmp = strchr(mem_head->sas_dsname, ' '); - n = (int)(tmp - mem_head->sas_dsname); - if(n > 0) { - if (n > 8) - n = 8; - strncpy(name, mem_head->sas_dsname, n); - name[n] = '\0'; - } else name[0] = '\0'; + tmp = strchr(mem_head->sas_dsname, ' '); + n = (int)(tmp - mem_head->sas_dsname); + if(n > 0) { + if (n > 8) + n = 8; + strncpy(name, mem_head->sas_dsname, n); + name[n] = '\0'; + } else name[0] = '\0'; - /* Extract data set label, and trim trailing blanks */ - strncpy(dslabel, mem_head->sas_dslabel, 40); - for(int i=40-1; i>0; i--) - if( isspace(dslabel[i]) ) - dslabel[i] = '\0'; - else - break; + /* Extract data set label, and trim trailing blanks */ + strncpy(dslabel, mem_head->sas_dslabel, 40); + for(int i=40-1; i>0; i--) + if( isspace(dslabel[i]) ) + dslabel[i] = '\0'; + else + break; - /* Extract data set type */ - strncpy(dstype, mem_head->sas_dstype, 8); - for(int i=8-1; i>0; i--) - if( isspace(dstype[i]) ) - dstype[i] = '\0'; - else - break; + /* Extract data set type */ + strncpy(dstype, mem_head->sas_dstype, 8); + for(int i=8-1; i>0; i--) + if( isspace(dstype[i]) ) + dstype[i] = '\0'; + else + break; - Free(mem_head); + Free(mem_head); - return length; + return length; } static int @@ -310,176 +310,176 @@ int *nifd, int *npos) { - char *tmp; - char record[81]; - int i, n, totwidth, nlength, restOfCard; - struct SAS_XPORT_namestr *nam_head; + char *tmp; + char record[81]; + int i, n, totwidth, nlength, restOfCard; + struct SAS_XPORT_namestr *nam_head; - nam_head = Calloc(nvars, struct SAS_XPORT_namestr); + nam_head = Calloc(nvars, struct SAS_XPORT_namestr); - for(i = 0; i < nvars; i++) { - if(!get_nam_header(fp, nam_head+i, namestr_length)) { - Free(nam_head); - error(_("SAS transfer file has incorrect library header")); - } + for(i = 0; i < nvars; i++) { + if(!get_nam_header(fp, nam_head+i, namestr_length)) { + Free(nam_head); + error(_("SAS transfer file has incorrect library header")); } + } - *headpad = 480 + nvars * namestr_length; - i = *headpad % 80; - if(i > 0) { - i = 80 - i; - if (fseek(fp, i, SEEK_CUR) != 0) { - Free(nam_head); - error(_("file not in SAS transfer format")); - } - (*headpad) += i; + *headpad = 480 + nvars * namestr_length; + i = *headpad % 80; + if(i > 0) { + i = 80 - i; + if (fseek(fp, i, SEEK_CUR) != 0) { + Free(nam_head); + error(_("file not in SAS transfer format")); } + (*headpad) += i; + } - n = GET_RECORD(record, fp, 80); - if(n != 80 || strncmp(OBS_HEADER, record, 80) != 0) { - Free(nam_head); - error(_("file not in SAS transfer format")); - } + n = GET_RECORD(record, fp, 80); + if(n != 80 || strncmp(OBS_HEADER, record, 80) != 0) { + Free(nam_head); + error(_("file not in SAS transfer format")); + } - for(i = 0; i < nvars; i++) { - int nname_len = 0, nlabel_len = 0, nform_len = 0, niform_len=0; - char tmpname[41]; + for(i = 0; i < nvars; i++) { + int nname_len = 0, nlabel_len = 0, nform_len = 0, niform_len=0; + char tmpname[41]; - /* Variable storage type */ - ntype[i] = (int) ((nam_head[i].ntype == 1) ? REALSXP : STRSXP); + /* Variable storage type */ + ntype[i] = (int) ((nam_head[i].ntype == 1) ? REALSXP : STRSXP); - /* Storage length */ - nlng[i] = nam_head[i].nlng; + /* Storage length */ + nlng[i] = nam_head[i].nlng; - /* Variable number */ - nvar0[i] = nam_head[i].nvar0; + /* Variable number */ + nvar0[i] = nam_head[i].nvar0; - /* Position of var in observation */ - npos[i] = nam_head[i].npos; + /* Position of var in observation */ + npos[i] = nam_head[i].npos; - /* Variable name */ - nname_len = 8; - while (nname_len && nam_head[i].nname[nname_len-1] == ' ') - nname_len--; - strncpy(tmpname, nam_head[i].nname, nname_len); - tmpname[nname_len] = '\0'; - SET_STRING_ELT(nname, i, mkChar(tmpname)); + /* Variable name */ + nname_len = 8; + while (nname_len && nam_head[i].nname[nname_len-1] == ' ') + nname_len--; + strncpy(tmpname, nam_head[i].nname, nname_len); + tmpname[nname_len] = '\0'; + SET_STRING_ELT(nname, i, mkChar(tmpname)); - /* Variable label */ - nlabel_len = 40; - while (nlabel_len && nam_head[i].nlabel[nlabel_len-1] == ' ') - nlabel_len--; - strncpy(tmpname, nam_head[i].nlabel, nlabel_len); - tmpname[nlabel_len] = '\0'; - SET_STRING_ELT(nlabel, i, mkChar(tmpname)); + /* Variable label */ + nlabel_len = 40; + while (nlabel_len && nam_head[i].nlabel[nlabel_len-1] == ' ') + nlabel_len--; + strncpy(tmpname, nam_head[i].nlabel, nlabel_len); + tmpname[nlabel_len] = '\0'; + SET_STRING_ELT(nlabel, i, mkChar(tmpname)); - /* Variable format name */ - nform_len = 8; - while (nform_len && nam_head[i].nform[nform_len-1] == ' ') - nform_len--; - strncpy(tmpname, nam_head[i].nform, nform_len); - tmpname[nform_len] = '\0'; - SET_STRING_ELT(nform, i, mkChar(tmpname)); + /* Variable format name */ + nform_len = 8; + while (nform_len && nam_head[i].nform[nform_len-1] == ' ') + nform_len--; + strncpy(tmpname, nam_head[i].nform, nform_len); + tmpname[nform_len] = '\0'; + SET_STRING_ELT(nform, i, mkChar(tmpname)); - /* Format length */ - nfl[i] = nam_head[i].nfl;; + /* Format length */ + nfl[i] = nam_head[i].nfl;; - /* Format digits */ - nfd[i] = nam_head[i].nfd;; + /* Format digits */ + nfd[i] = nam_head[i].nfd;; - /* Variable iformat name */ - niform_len = 8; - while (niform_len && nam_head[i].niform[niform_len-1] == ' ') - niform_len--; - strncpy(tmpname, nam_head[i].niform, niform_len); - tmpname[niform_len] = '\0'; - SET_STRING_ELT(niform, i, mkChar(tmpname)); + /* Variable iformat name */ + niform_len = 8; + while (niform_len && nam_head[i].niform[niform_len-1] == ' ') + niform_len--; + strncpy(tmpname, nam_head[i].niform, niform_len); + tmpname[niform_len] = '\0'; + SET_STRING_ELT(niform, i, mkChar(tmpname)); - /* Format length */ - nifl[i] = nam_head[i].nifl;; + /* Format length */ + nifl[i] = nam_head[i].nifl;; - /* Format digits */ - nifd[i] = nam_head[i].nifd;; + /* Format digits */ + nifd[i] = nam_head[i].nifd;; - } + } - Free(nam_head); + Free(nam_head); - totwidth = 0; - for(i = 0; i < nvars; i++) - totwidth += nlng[i]; + totwidth = 0; + for(i = 0; i < nvars; i++) + totwidth += nlng[i]; - nlength = 0; - tmp = Calloc(totwidth <= 80 ? 81 : (totwidth+1), char); - restOfCard = 0; - *tailpad = 0; - while(!feof(fp)) { - int allSpace = 1; - fpos_t currentPos; + nlength = 0; + tmp = Calloc(totwidth <= 80 ? 81 : (totwidth+1), char); + restOfCard = 0; + *tailpad = 0; + while(!feof(fp)) { + int allSpace = 1; + fpos_t currentPos; -/* restOfCard = 80 - (ftell(fp) % 80); */ - if (fgetpos(fp, ¤tPos)) { - error(_("problem accessing SAS XPORT file")); - } + /* restOfCard = 80 - (ftell(fp) % 80); */ + if (fgetpos(fp, ¤tPos)) { + error(_("problem accessing SAS XPORT file")); + } - n = GET_RECORD(tmp, fp, restOfCard); - if (n != restOfCard) { - allSpace = 0; - } else { - for (i = 0; i < restOfCard; i++) { - if (tmp[i] != ' ') { - allSpace = 0; - break; - } - } + n = GET_RECORD(tmp, fp, restOfCard); + if (n != restOfCard) { + allSpace = 0; + } else { + for (i = 0; i < restOfCard; i++) { + if (tmp[i] != ' ') { + allSpace = 0; + break; } - if (allSpace) { - n = GET_RECORD(record, fp, 80); - if (n < 1) { - *tailpad = restOfCard; - break; - } - if(n == 80 && strncmp(MEM_HEADER, record, 75) == 0 && - strncmp(" ", record+78, 2) == 0) { - *tailpad = restOfCard; - record[78] = '\0'; - sscanf(record+75, "%d", &namestr_length); - break; - } - } - else /* beware that the previous member can end on card - * boundary with no padding */ - if (restOfCard == 80 && n == 80 && - strncmp(MEM_HEADER, tmp, 75) == 0 && - strncmp(" ", tmp+78, 2) == 0) { - strncpy(record, tmp, 80); - *tailpad = 0; - record[78] = '\0'; - sscanf(record+75, "%d", &namestr_length); - break; - } + } + } + if (allSpace) { + n = GET_RECORD(record, fp, 80); + if (n < 1) { + *tailpad = restOfCard; + break; + } + if(n == 80 && strncmp(MEM_HEADER, record, 75) == 0 && + strncmp(" ", record+78, 2) == 0) { + *tailpad = restOfCard; + record[78] = '\0'; + sscanf(record+75, "%d", &namestr_length); + break; + } + } + else /* beware that the previous member can end on card + * boundary with no padding */ + if (restOfCard == 80 && n == 80 && + strncmp(MEM_HEADER, tmp, 75) == 0 && + strncmp(" ", tmp+78, 2) == 0) { + strncpy(record, tmp, 80); + *tailpad = 0; + record[78] = '\0'; + sscanf(record+75, "%d", &namestr_length); + break; + } - if (fsetpos(fp, ¤tPos)) { - error(_("problem accessing SAS XPORT file")); - } + if (fsetpos(fp, ¤tPos)) { + error(_("problem accessing SAS XPORT file")); + } - n = GET_RECORD(tmp, fp, totwidth); - if (n != totwidth) { - if (!feof(fp)) { - error(_("problem accessing SAS XPORT file")); - } - *tailpad = n; - break; - } - restOfCard = (restOfCard >= totwidth)? - (restOfCard - totwidth): - (80 - (totwidth - restOfCard)%80); - nlength++; + n = GET_RECORD(tmp, fp, totwidth); + if (n != totwidth) { + if (!feof(fp)) { + error(_("problem accessing SAS XPORT file")); + } + *tailpad = n; + break; } - *length = nlength; - Free(tmp); + restOfCard = (restOfCard >= totwidth)? + (restOfCard - totwidth): + (80 - (totwidth - restOfCard)%80); + nlength++; + } + *length = nlength; + Free(tmp); - return (feof(fp)?-1:namestr_length); + return (feof(fp)?-1:namestr_length); } /* @@ -488,42 +488,42 @@ static SEXP getListElement(SEXP list, char *str) { - SEXP names; - SEXP elmt = (SEXP) NULL; - const char *tempChar; - int i; + SEXP names; + SEXP elmt = (SEXP) NULL; + const char *tempChar; + int i; - names = getAttrib(list, R_NamesSymbol); + names = getAttrib(list, R_NamesSymbol); - for (i = 0; i < LENGTH(list); i++) { - tempChar = CHAR(STRING_ELT(names, i)); - if( strcmp(tempChar,str) == 0) { - elmt = VECTOR_ELT(list, i); - break; - } + for (i = 0; i < LENGTH(list); i++) { + tempChar = CHAR(STRING_ELT(names, i)); + if( strcmp(tempChar,str) == 0) { + elmt = VECTOR_ELT(list, i); + break; } - return elmt; + } + return elmt; } #define VAR_INFO_LENGTH 16 const char *cVarInfoNames[VAR_INFO_LENGTH] = { - "headpad", - "type", - "width", - "index", - "position", - "name", - "label", - "format", - "flength", - "fdigits", - "iformat", - "iflength", - "ifdigits", - "sexptype", - "tailpad", - "length" + "headpad", + "type", + "width", + "index", + "position", + "name", + "label", + "format", + "flength", + "fdigits", + "iformat", + "iflength", + "ifdigits", + "sexptype", + "tailpad", + "length" }; #define XPORT_VAR_HEADPAD(varinfo) VECTOR_ELT(varinfo, 0) @@ -564,214 +564,210 @@ SEXP xport_info(SEXP xportFile) { - FILE *fp; - int i, namestrLength, memLength, ansLength; - char dsname[9]; - char dslabel[41]; - char dstype[9]; - SEXP ans, ansNames, varInfoNames, varInfo; - SEXP char_numeric, char_character; - SEXP dfLabel, dfType; + FILE *fp; + int i, namestrLength, memLength, ansLength; + char dsname[9]; + char dslabel[41]; + char dstype[9]; + SEXP ans, ansNames, varInfoNames, varInfo; + SEXP char_numeric, char_character; + SEXP dfLabel, dfType; - PROTECT(varInfoNames = allocVector(STRSXP, VAR_INFO_LENGTH)); - for(i = 0; i < VAR_INFO_LENGTH; i++) - SET_STRING_ELT(varInfoNames, i, mkChar(cVarInfoNames[i])); + PROTECT(varInfoNames = allocVector(STRSXP, VAR_INFO_LENGTH)); + for(i = 0; i < VAR_INFO_LENGTH; i++) + SET_STRING_ELT(varInfoNames, i, mkChar(cVarInfoNames[i])); - PROTECT(char_numeric = mkChar("numeric")); - PROTECT(char_character = mkChar("character")); + PROTECT(char_numeric = mkChar("numeric")); + PROTECT(char_character = mkChar("character")); - if(!isValidString(xportFile)) - error(_("first argument must be a file name")); - fp = fopen(R_ExpandFileName(CHAR(STRING_ELT(xportFile, 0))), "rb"); - if (!fp) - error(_("unable to open file: '%s'"), strerror(errno)); - namestrLength = init_xport_info(fp); + if(!isValidString(xportFile)) + error(_("first argument must be a file name")); + fp = fopen(R_ExpandFileName(CHAR(STRING_ELT(xportFile, 0))), "rb"); + if (!fp) + error(_("unable to open file: '%s'"), strerror(errno)); + namestrLength = init_xport_info(fp); - ansLength = 0; - PROTECT(ans = allocVector(VECSXP, 0)); - PROTECT(ansNames = allocVector(STRSXP, 0)); + ansLength = 0; + PROTECT(ans = allocVector(VECSXP, 0)); + PROTECT(ansNames = allocVector(STRSXP, 0)); - while(!feof(fp)) - { - memLength = init_mem_info(fp, dsname, dslabel, dstype); + while(!feof(fp)) + { + memLength = init_mem_info(fp, dsname, dslabel, dstype); - PROTECT(varInfo = allocVector(VECSXP, VAR_INFO_LENGTH)); - setAttrib(varInfo, R_NamesSymbol, varInfoNames); + PROTECT(varInfo = allocVector(VECSXP, VAR_INFO_LENGTH)); + setAttrib(varInfo, R_NamesSymbol, varInfoNames); - dslabel[40] = '\n'; - PROTECT(dfLabel = allocVector(STRSXP, 1)); - SET_STRING_ELT(dfLabel, 0, mkChar(dslabel)); - setAttrib(varInfo, install("label" ), dfLabel); + dslabel[40] = '\n'; + PROTECT(dfLabel = allocVector(STRSXP, 1)); + SET_STRING_ELT(dfLabel, 0, mkChar(dslabel)); + setAttrib(varInfo, install("label" ), dfLabel); - dstype[8] = '\n'; - PROTECT(dfType = allocVector(STRSXP, 1)); - SET_STRING_ELT(dfType, 0, mkChar(dstype)); - setAttrib(varInfo, install("SAStype"), dfType ); + dstype[8] = '\n'; + PROTECT(dfType = allocVector(STRSXP, 1)); + SET_STRING_ELT(dfType, 0, mkChar(dstype)); + setAttrib(varInfo, install("SAStype"), dfType ); - SET_XPORT_VAR_TYPE(varInfo, allocVector(STRSXP, memLength)); - SET_XPORT_VAR_WIDTH(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_INDEX(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_POSITION(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_NAME(varInfo, allocVector(STRSXP, memLength)); - SET_XPORT_VAR_LABEL(varInfo, allocVector(STRSXP, memLength)); - SET_XPORT_VAR_FORM(varInfo, allocVector(STRSXP, memLength)); - SET_XPORT_VAR_FLENGTH(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_FDIGITS(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_IFORM(varInfo, allocVector(STRSXP, memLength)); - SET_XPORT_VAR_IFLENGTH(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_IFDIGITS(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_SEXPTYPE(varInfo, allocVector(INTSXP, memLength)); - SET_XPORT_VAR_HEADPAD(varInfo, allocVector(INTSXP, 1)); - SET_XPORT_VAR_TAILPAD(varInfo, allocVector(INTSXP, 1)); - SET_XPORT_VAR_LENGTH(varInfo, allocVector(INTSXP, 1)); + SET_XPORT_VAR_TYPE(varInfo, allocVector(STRSXP, memLength)); + SET_XPORT_VAR_WIDTH(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_INDEX(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_POSITION(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_NAME(varInfo, allocVector(STRSXP, memLength)); + SET_XPORT_VAR_LABEL(varInfo, allocVector(STRSXP, memLength)); + SET_XPORT_VAR_FORM(varInfo, allocVector(STRSXP, memLength)); + SET_XPORT_VAR_FLENGTH(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_FDIGITS(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_IFORM(varInfo, allocVector(STRSXP, memLength)); + SET_XPORT_VAR_IFLENGTH(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_IFDIGITS(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_SEXPTYPE(varInfo, allocVector(INTSXP, memLength)); + SET_XPORT_VAR_HEADPAD(varInfo, allocVector(INTSXP, 1)); + SET_XPORT_VAR_TAILPAD(varInfo, allocVector(INTSXP, 1)); + SET_XPORT_VAR_LENGTH(varInfo, allocVector(INTSXP, 1)); - namestrLength = - next_xport_info(fp, namestrLength, memLength, - INTEGER(XPORT_VAR_HEADPAD(varInfo)), - INTEGER(XPORT_VAR_TAILPAD(varInfo)), - INTEGER(XPORT_VAR_LENGTH(varInfo)), - INTEGER(XPORT_VAR_SEXPTYPE(varInfo)), - INTEGER(XPORT_VAR_WIDTH(varInfo)), - INTEGER(XPORT_VAR_INDEX(varInfo)), - XPORT_VAR_NAME(varInfo), - XPORT_VAR_LABEL(varInfo), - XPORT_VAR_FORM(varInfo), - INTEGER(XPORT_VAR_FLENGTH(varInfo)), - INTEGER(XPORT_VAR_FDIGITS(varInfo)), - XPORT_VAR_IFORM(varInfo), - INTEGER(XPORT_VAR_IFLENGTH(varInfo)), - INTEGER(XPORT_VAR_IFDIGITS(varInfo)), - INTEGER(XPORT_VAR_POSITION(varInfo)) - ); + namestrLength = + next_xport_info(fp, namestrLength, memLength, + INTEGER(XPORT_VAR_HEADPAD(varInfo)), + INTEGER(XPORT_VAR_TAILPAD(varInfo)), + INTEGER(XPORT_VAR_LENGTH(varInfo)), + INTEGER(XPORT_VAR_SEXPTYPE(varInfo)), + INTEGER(XPORT_VAR_WIDTH(varInfo)), + INTEGER(XPORT_VAR_INDEX(varInfo)), + XPORT_VAR_NAME(varInfo), + XPORT_VAR_LABEL(varInfo), + XPORT_VAR_FORM(varInfo), + INTEGER(XPORT_VAR_FLENGTH(varInfo)), + INTEGER(XPORT_VAR_FDIGITS(varInfo)), + XPORT_VAR_IFORM(varInfo), + INTEGER(XPORT_VAR_IFLENGTH(varInfo)), + INTEGER(XPORT_VAR_IFDIGITS(varInfo)), + INTEGER(XPORT_VAR_POSITION(varInfo)) + ); - for(i = 0; i < memLength; i++) { - int *ntype = INTEGER(XPORT_VAR_SEXPTYPE(varInfo)); - SET_STRING_ELT(XPORT_VAR_TYPE(varInfo), i, - (ntype[i] == REALSXP) ? char_numeric : - char_character); - } - PROTECT(ans = lengthgets(ans, ansLength+1)); - PROTECT(ansNames = lengthgets(ansNames, ansLength+1)); + for(i = 0; i < memLength; i++) { + int *ntype = INTEGER(XPORT_VAR_SEXPTYPE(varInfo)); + SET_STRING_ELT(XPORT_VAR_TYPE(varInfo), i, + (ntype[i] == REALSXP) ? char_numeric : + char_character); + } + PROTECT(ans = lengthgets(ans, ansLength+1)); + PROTECT(ansNames = lengthgets(ansNames, ansLength+1)); -/* PROTECT(newAns = allocVector(VECSXP, ansLength+1)); */ -/* PROTECT(newAnsNames = allocVector(STRSXP, ansLength+1)); */ + /* PROTECT(newAns = allocVector(VECSXP, ansLength+1)); */ + /* PROTECT(newAnsNames = allocVector(STRSXP, ansLength+1)); */ -/* for(i = 0; i < ansLength; i++) { */ -/* SET_VECTOR_ELT(newAns, i, VECTOR_ELT(ans, i)); */ -/* SET_STRING_ELT(newAnsNames, i, STRING_ELT(ansNames, i)); */ -/* } */ -/* ans = newAns; */ -/* ansNames = newAnsNames; */ + /* for(i = 0; i < ansLength; i++) { */ + /* SET_VECTOR_ELT(newAns, i, VECTOR_ELT(ans, i)); */ + /* SET_STRING_ELT(newAnsNames, i, STRING_ELT(ansNames, i)); */ + /* } */ + /* ans = newAns; */ + /* ansNames = newAnsNames; */ - SET_STRING_ELT(ansNames , ansLength, mkChar(dsname )); - SET_VECTOR_ELT(ans, ansLength, varInfo); - ansLength++; + SET_STRING_ELT(ansNames , ansLength, mkChar(dsname )); + SET_VECTOR_ELT(ans, ansLength, varInfo); + ansLength++; - UNPROTECT(7); - PROTECT(ans); - PROTECT(ansNames); + UNPROTECT(7); + PROTECT(ans); + PROTECT(ansNames); } - setAttrib(ans, R_NamesSymbol, ansNames); - UNPROTECT(5); - fclose(fp); - return ans; + setAttrib(ans, R_NamesSymbol, ansNames); + UNPROTECT(5); + fclose(fp); + return ans; } SEXP xport_read(SEXP xportFile, SEXP xportInfo) { - int i, j, k, n; - int nvar; - int ansLength, dataLength, totalWidth; - int dataHeadPad, dataTailPad; - int *dataWidth; - int *dataPosition; - SEXPTYPE *dataType; - char *record, *tmpchar, *c; - FILE *fp; - SEXP ans, names, data, dataInfo, dataName; - double dbl; + int i, j, k, n; + int nvar; + int ansLength, dataLength, totalWidth; + int dataHeadPad, dataTailPad; + int *dataWidth; + int *dataPosition; + SEXPTYPE *dataType; + char *record, *tmpchar, *c; + FILE *fp; + SEXP ans, names, data, dataInfo, dataName; + double dbl; - ansLength = LENGTH(xportInfo); - PROTECT(ans = allocVector(VECSXP, ansLength)); - names = getAttrib(xportInfo, R_NamesSymbol); - setAttrib(ans, R_NamesSymbol, names); + ansLength = LENGTH(xportInfo); + PROTECT(ans = allocVector(VECSXP, ansLength)); + names = getAttrib(xportInfo, R_NamesSymbol); + setAttrib(ans, R_NamesSymbol, names); - if(!isValidString(xportFile)) - error(_("first argument must be a file name")); - fp = fopen(R_ExpandFileName(CHAR(STRING_ELT(xportFile, 0))), "rb"); - if (!fp) - error(_("unable to open file: '%s'"), strerror(errno)); - if (fseek(fp, 240, SEEK_SET) != 0) - error(_("problem reading SAS XPORT file '%s'"), - CHAR(STRING_ELT(xportFile, 0))); + if(!isValidString(xportFile)) + error(_("first argument must be a file name")); + fp = fopen(R_ExpandFileName(CHAR(STRING_ELT(xportFile, 0))), "rb"); + if (!fp) + error(_("unable to open file: '%s'"), strerror(errno)); + if (fseek(fp, 240, SEEK_SET) != 0) + error(_("problem reading SAS XPORT file '%s'"), + CHAR(STRING_ELT(xportFile, 0))); - for(i = 0; i < ansLength; i++) { - dataInfo = VECTOR_ELT(xportInfo, i); - dataName = getListElement(dataInfo, "name"); - nvar = LENGTH(dataName); - dataLength = asInteger(getListElement(dataInfo, "length")); - SET_VECTOR_ELT(ans, i, data = allocVector(VECSXP, nvar)); - setAttrib(data, R_NamesSymbol, dataName); - dataType = (SEXPTYPE *) INTEGER(getListElement(dataInfo, "sexptype")); - for(j = 0; j < nvar; j++) - SET_VECTOR_ELT(data, j, allocVector(dataType[j], dataLength)); + for(i = 0; i < ansLength; i++) { + dataInfo = VECTOR_ELT(xportInfo, i); + dataName = getListElement(dataInfo, "name"); + nvar = LENGTH(dataName); + dataLength = asInteger(getListElement(dataInfo, "length")); + SET_VECTOR_ELT(ans, i, data = allocVector(VECSXP, nvar)); + setAttrib(data, R_NamesSymbol, dataName); + dataType = (SEXPTYPE *) INTEGER(getListElement(dataInfo, "sexptype")); + for(j = 0; j < nvar; j++) + SET_VECTOR_ELT(data, j, allocVector(dataType[j], dataLength)); - dataWidth = INTEGER(getListElement(dataInfo, "width")); - dataPosition = INTEGER(getListElement(dataInfo, "position")); + dataWidth = INTEGER(getListElement(dataInfo, "width")); + dataPosition = INTEGER(getListElement(dataInfo, "position")); - totalWidth = 0; - for(j = 0; j < nvar; j++) - totalWidth += dataWidth[j]; - record = Calloc(totalWidth + 1, char); + totalWidth = 0; + for(j = 0; j < nvar; j++) + totalWidth += dataWidth[j]; + record = Calloc(totalWidth + 1, char); - dataHeadPad = asInteger(getListElement(dataInfo, "headpad")); - dataTailPad = asInteger(getListElement(dataInfo, "tailpad")); - fseek(fp, dataHeadPad, SEEK_CUR); + dataHeadPad = asInteger(getListElement(dataInfo, "headpad")); + dataTailPad = asInteger(getListElement(dataInfo, "tailpad")); + fseek(fp, dataHeadPad, SEEK_CUR); - for(j = 0; j < dataLength; j++) { - n = GET_RECORD(record, fp, totalWidth); - if(n != totalWidth) { - error(_("problem reading SAS transport file")); - } + for(j = 0; j < dataLength; j++) { + n = GET_RECORD(record, fp, totalWidth); + if(n != totalWidth) { + error(_("problem reading SAS transport file")); + } - for(k = nvar-1; k >= 0; k--) { - tmpchar = record + dataPosition[k]; - if(dataType[k] == REALSXP) { + for(k = nvar-1; k >= 0; k--) { + tmpchar = record + dataPosition[k]; + if(dataType[k] == REALSXP) + { +#ifdef BIGENDIAN + reverse_double(tmpchar); +#endif - /* REAL(VECTOR_ELT(data, k))[j] = */ - /* get_IBM_double(tmpchar, dataWidth[k]); */ + REAL(VECTOR_ELT(data, k))[j] = + get_IBM_double(tmpchar, dataWidth[k]); + } + else + { + tmpchar[dataWidth[k]] = '\0'; + /* strip trailing blanks */ + c = tmpchar + dataWidth[k]; + while (c-- > tmpchar && *c == ' ') + *c ='\0'; - ibm2ieee( (unsigned char*) &dbl, - (unsigned char*) tmpchar, - 1 ); + SET_STRING_ELT(VECTOR_ELT(data, k), j, + (c < tmpchar) ? R_BlankString : + mkChar(tmpchar)); + } + } + } - /* convert from big-endian layout */ - to_bigend( (unsigned char*) &dbl, sizeof(double) ); + fseek(fp, dataTailPad, SEEK_CUR); - REAL(VECTOR_ELT(data, k))[j] = dbl; - - } else { - tmpchar[dataWidth[k]] = '\0'; - /* strip trailing blanks */ - c = tmpchar + dataWidth[k]; - while (c-- > tmpchar && *c == ' ') - *c ='\0'; - - SET_STRING_ELT(VECTOR_ELT(data, k), j, - (c < tmpchar) ? R_BlankString : - mkChar(tmpchar)); - } - } - } - - fseek(fp, dataTailPad, SEEK_CUR); - - Free(record); - } - UNPROTECT(1); - fclose(fp); - return ans; + Free(record); + } + UNPROTECT(1); + fclose(fp); + return ans; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-20 02:17:28
|
Revision: 1850 http://sourceforge.net/p/r-gregmisc/code/1850 Author: warnes Date: 2014-07-20 02:17:21 +0000 (Sun, 20 Jul 2014) Log Message: ----------- Finish rename of 'HTOBE' to 'TO_BIGEND' Modified Paths: -------------- trunk/SASxport/src/writeSAS.c trunk/SASxport/src/writeSAS.h Modified: trunk/SASxport/src/writeSAS.c =================================================================== --- trunk/SASxport/src/writeSAS.c 2014-07-20 02:15:13 UTC (rev 1849) +++ trunk/SASxport/src/writeSAS.c 2014-07-20 02:17:21 UTC (rev 1850) @@ -32,9 +32,6 @@ #include "writeSAS.h" - - - /* Fill <target> buffer with <len> blanks without any terminating nulls */ void blankFill(char *target, int len) { @@ -198,7 +195,6 @@ ) { struct NAMESTR_HEADER namestr_header; - char tmpBuf[5]; blankCopy( namestr_header.l1, 54, "HEADER RECORD*******NAMESTR HEADER RECORD!!!!!!!000000"); blankCopy( namestr_header.nvar, 4, nvar[0] ); @@ -260,17 +256,17 @@ zeroFill(namestr_record.rest, 52); /* remaining fields are irrelevant */ - HTOBE_SHORT( namestr_record.ntype ); - HTOBE_SHORT( namestr_record.nhfun ); - HTOBE_SHORT( namestr_record.nlng ); - HTOBE_SHORT( namestr_record.nvar0 ); - HTOBE_SHORT( namestr_record.nfl ); - HTOBE_SHORT( namestr_record.nfd ); - HTOBE_SHORT( namestr_record.nfj ); - HTOBE_SHORT( namestr_record.nifl ); - HTOBE_SHORT( namestr_record.nifd ); + TO_BIGEND_SHORT( namestr_record.ntype ); + TO_BIGEND_SHORT( namestr_record.nhfun ); + TO_BIGEND_SHORT( namestr_record.nlng ); + TO_BIGEND_SHORT( namestr_record.nvar0 ); + TO_BIGEND_SHORT( namestr_record.nfl ); + TO_BIGEND_SHORT( namestr_record.nfd ); + TO_BIGEND_SHORT( namestr_record.nfj ); + TO_BIGEND_SHORT( namestr_record.nifl ); + TO_BIGEND_SHORT( namestr_record.nifd ); - HTOBE_INT ( namestr_record.npos ); + TO_BIGEND_INT ( namestr_record.npos ); /* copy filled struct to return area */ memcpy( raw_buffer, &namestr_record, sizeof(namestr_record) ); @@ -306,7 +302,7 @@ /* convert to IBM floating point */ /* first convert to big-endian layout */ - HTOBE_DOUBLE( value ); + TO_BIGEND_DOUBLE( value ); /* now convert to ibm flaoting point format */ ieee2ibm( (unsigned char *) raw_buffer, (unsigned char *) value, 1); Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-20 02:15:13 UTC (rev 1849) +++ trunk/SASxport/src/writeSAS.h 2014-07-20 02:17:21 UTC (rev 1850) @@ -30,6 +30,8 @@ #include <R.h> #include <Rinternals.h> #include <sys/types.h> +#include "to_bigend.h" +#include "ibm2ieee.h" /***** @@ -49,14 +51,9 @@ #define ASSERT(x) if(!(x)) error("Assertion failed: x") #endif -/* Convert (if necessary) to Big-Endian */ -#define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) -#define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) -#define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) &a, sizeof(double) ) - /* Alternative definition using system functions: */ -/* #define HTOBE_SHORT(a) (a) = htons( a ) */ -/* #define HTOBE_INT(a) (a) = htonl( a ) */ +/* #define TO_BIGEND_SHORT(a) (a) = htons( a ) */ +/* #define TO_BIGEND_INT(a) (a) = htonl( a ) */ /***** * File Record Structures @@ -172,7 +169,6 @@ void doTest(); -void host_to_be( unsigned char *intp, size_t size); void ieee2ibm(register unsigned char *out, register const unsigned char *in, int count); -#endif /* FIELDS_H */ +#endif /* WRITESAS_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-20 02:15:15
|
Revision: 1849 http://sourceforge.net/p/r-gregmisc/code/1849 Author: warnes Date: 2014-07-20 02:15:13 +0000 (Sun, 20 Jul 2014) Log Message: ----------- Add dummy code to avoid compile warnings about unneeded variables Modified Paths: -------------- trunk/SASxport/src/test_fields.c Modified: trunk/SASxport/src/test_fields.c =================================================================== --- trunk/SASxport/src/test_fields.c 2014-07-20 02:05:33 UTC (rev 1848) +++ trunk/SASxport/src/test_fields.c 2014-07-20 02:15:13 UTC (rev 1849) @@ -4,8 +4,8 @@ * * Author: Gregory R. Warnes <gr...@wa...> * - * Copyright (C) 2007 Gregory R. Warnes - * + * Copyright (C) 2007 Gregory R. Warnes + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -40,7 +40,7 @@ char buffer[bufsize]; char postbuffer = 'c'; int i; - + /* fill the buffer with 'x' */ for(i=0; i<bufsize; i++) buffer[i] = 'x'; @@ -56,6 +56,8 @@ assert( prebuffer == 'c' ); assert( postbuffer == 'c' ); + postbuffer = prebuffer; //* Avoid compiler warning about unused varibles */ + return 0; } @@ -68,7 +70,7 @@ char *shortstr = "abc"; char *longstr = "123456789012345678901234567890"; int i; - + /* fill the buffer with 'x' */ for(i=0; i<bufsize; i++) buffer[i] = 'x'; @@ -103,6 +105,8 @@ assert( prebuffer == 'c' ); assert( postbuffer == 'c' ); + postbuffer = prebuffer; //* Avoid compiler warning about unused varibles */ + return 0; } @@ -114,7 +118,7 @@ char buffer[bufsize]; char postbuffer = 'c'; int i; - + /* fill the buffer with 'x' */ for(i=0; i<bufsize; i++) buffer[i] = 'x'; @@ -130,6 +134,8 @@ assert( prebuffer == 'c' ); assert( postbuffer == 'c' ); + postbuffer = prebuffer; //* Avoid compiler warning about unused varibles */ + return 0; } @@ -142,7 +148,7 @@ char *shortstr = "abc"; char *longstr = "123456789012345678901234567890123456789012345678901234567890"; int i; - + /* fill the buffer with 'x' */ for(i=0; i<bufsize; i++) buffer[i] = 'x'; @@ -177,6 +183,8 @@ assert( prebuffer == 'c' ); assert( postbuffer == 'c' ); + postbuffer = prebuffer; //* Avoid compiler warning about unused varibles */ + return 0; } @@ -190,7 +198,7 @@ test_blankCopy(SMALL); test_zeroCopy(SMALL); - + /* big buffer */ test_blankFill(BIG); test_zeroFill(BIG); @@ -198,4 +206,4 @@ test_blankCopy(BIG); test_zeroCopy(BIG); } - + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-20 02:05:41
|
Revision: 1848 http://sourceforge.net/p/r-gregmisc/code/1848 Author: warnes Date: 2014-07-20 02:05:33 +0000 (Sun, 20 Jul 2014) Log Message: ----------- Rename 'host_to_be' to 'to_bigend' to be more transparent about purpose Modified Paths: -------------- trunk/SASxport/src/SASxport.c trunk/SASxport/src/SASxport.h trunk/SASxport/src/ibm2ieee.c trunk/SASxport/src/ieee2ibm.c Added Paths: ----------- trunk/SASxport/src/ibm2ieee.h Modified: trunk/SASxport/src/SASxport.c =================================================================== --- trunk/SASxport/src/SASxport.c 2014-07-20 02:01:34 UTC (rev 1847) +++ trunk/SASxport/src/SASxport.c 2014-07-20 02:05:33 UTC (rev 1848) @@ -48,7 +48,7 @@ #define BLANK24 " " #define GET_RECORD(rec, fp, len) \ - fread((rec), sizeof(char), (size_t) (len), (fp)) + (int) fread((rec), sizeof(char), (size_t) (len), (fp)) #define IS_SASNA_CHAR(c) ((c) == 0x5f || (c) == 0x2e || \ (0x41 <= (c) && (c) <= 0x5a)) @@ -80,9 +80,11 @@ /* exponent is expressed here as excess 70 (=64+6) to accomodate integer conversion of c[1] to c[4] */ - char negative = c[0] & 0x80, exponent = (c[0] & 0x7f) - 70, buf[4]; + char negative = c[0] & 0x80; + // needs to be signed: char is not on Raspbian + signed char exponent = (c[0] & 0x7f) - 70; double value; - char ibuf[8]; + char buf[4], ibuf[8]; if (len < 2 || len > 8) error(_("invalid field length in numeric variable")); @@ -258,9 +260,8 @@ record[58] = '\0'; sscanf(record+54, "%d", &length); - /* Extract data set name */ tmp = strchr(mem_head->sas_dsname, ' '); - n = tmp - mem_head->sas_dsname; + n = (int)(tmp - mem_head->sas_dsname); if(n > 0) { if (n > 8) n = 8; @@ -290,7 +291,9 @@ } static int -next_xport_info(FILE *fp, int namestr_length, int nvars, +next_xport_info(FILE *fp, + int namestr_length, + int nvars, int *headpad, int *tailpad, int *length, @@ -586,7 +589,7 @@ ansLength = 0; PROTECT(ans = allocVector(VECSXP, 0)); - PROTECT(ansNames = allocVector(STRSXP, 0)); + PROTECT(ansNames = allocVector(STRSXP, 0)); while(!feof(fp)) { @@ -689,6 +692,7 @@ char *record, *tmpchar, *c; FILE *fp; SEXP ans, names, data, dataInfo, dataName; + double dbl; ansLength = LENGTH(xportInfo); PROTECT(ans = allocVector(VECSXP, ansLength)); @@ -736,8 +740,19 @@ for(k = nvar-1; k >= 0; k--) { tmpchar = record + dataPosition[k]; if(dataType[k] == REALSXP) { - REAL(VECTOR_ELT(data, k))[j] = - get_IBM_double(tmpchar, dataWidth[k]); + + /* REAL(VECTOR_ELT(data, k))[j] = */ + /* get_IBM_double(tmpchar, dataWidth[k]); */ + + ibm2ieee( (unsigned char*) &dbl, + (unsigned char*) tmpchar, + 1 ); + + /* convert from big-endian layout */ + to_bigend( (unsigned char*) &dbl, sizeof(double) ); + + REAL(VECTOR_ELT(data, k))[j] = dbl; + } else { tmpchar[dataWidth[k]] = '\0'; /* strip trailing blanks */ Modified: trunk/SASxport/src/SASxport.h =================================================================== --- trunk/SASxport/src/SASxport.h 2014-07-20 02:01:34 UTC (rev 1847) +++ trunk/SASxport/src/SASxport.h 2014-07-20 02:05:33 UTC (rev 1848) @@ -28,6 +28,8 @@ #include "foreign.h" #include "swap_bytes.h" #include <errno.h> +#include "to_bigend.h" +#include "ibm2ieee.h" /* double cnxptiee(double from, int fromtype, int totype); */ Modified: trunk/SASxport/src/ibm2ieee.c =================================================================== --- trunk/SASxport/src/ibm2ieee.c 2014-07-20 02:01:34 UTC (rev 1847) +++ trunk/SASxport/src/ibm2ieee.c 2014-07-20 02:05:33 UTC (rev 1848) @@ -22,8 +22,8 @@ * information. */ -#include "writeSAS.h" #include <stdio.h> +#include "ibm2ieee.h" /**************************** * ibm2ieee @@ -40,29 +40,6 @@ * ***************************/ -#define OUT_IEEE_ZERO { \ - *out++ = 0; \ - *out++ = 0; \ - *out++ = 0; \ - *out++ = 0; \ - *out++ = 0; \ - *out++ = 0; \ - *out++ = 0; \ - *out++ = 0; \ - continue; } \ - -#define OUT_IEEE_NAN { /* Signaling NAN */ \ - *out++ = 0xFF; \ - *out++ = 0xF0; \ - *out++ = 0x0B; \ - *out++ = 0xAD; \ - *out++ = 0x0B; \ - *out++ = 0xAD; \ - *out++ = 0x0B; \ - *out++ = 0xAD; \ - continue; } \ - - void ibm2ieee(register unsigned char *out, register const unsigned char *in, int count) Added: trunk/SASxport/src/ibm2ieee.h =================================================================== --- trunk/SASxport/src/ibm2ieee.h (rev 0) +++ trunk/SASxport/src/ibm2ieee.h 2014-07-20 02:05:33 UTC (rev 1848) @@ -0,0 +1,62 @@ +/* + * File: SASxport/src/ibm2ieee.h + * + * Originally from BRL-CAD file /brlcad/src/libbu/htond.c + * + * Copyright (c) 2004-2007 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * * Minor changes (c) 2007 by Gregory R. Warnes <gr...@wa...> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +#ifndef IBM2IEEE_H +#define IBM2IEEE_H + +#include <R.h> +#include <Rinternals.h> + +#define OUT_IEEE_ZERO { \ + *out++ = 0; \ + *out++ = 0; \ + *out++ = 0; \ + *out++ = 0; \ + *out++ = 0; \ + *out++ = 0; \ + *out++ = 0; \ + *out++ = 0; \ + continue; } \ + +#define OUT_IEEE_NAN { /* Signaling NAN */ \ + *out++ = 0xFF; \ + *out++ = 0xF0; \ + *out++ = 0x0B; \ + *out++ = 0xAD; \ + *out++ = 0x0B; \ + *out++ = 0xAD; \ + *out++ = 0x0B; \ + *out++ = 0xAD; \ + continue; } \ + + +void ieee2ibm(register unsigned char *out, + register const unsigned char *in, + int count); + +void ibm2ieee(register unsigned char *out, + register const unsigned char *in, + int count); + + +#endif /* IBM2IEEE_H */ Modified: trunk/SASxport/src/ieee2ibm.c =================================================================== --- trunk/SASxport/src/ieee2ibm.c 2014-07-20 02:01:34 UTC (rev 1847) +++ trunk/SASxport/src/ieee2ibm.c 2014-07-20 02:05:33 UTC (rev 1848) @@ -22,8 +22,8 @@ * information. */ -#include "writeSAS.h" #include <stdio.h> +#include "ibm2ieee.h" /**************************** * ieee2ibm This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-20 02:01:43
|
Revision: 1847 http://sourceforge.net/p/r-gregmisc/code/1847 Author: warnes Date: 2014-07-20 02:01:34 +0000 (Sun, 20 Jul 2014) Log Message: ----------- Rename 'host_to_be' to 'to_bigend' to be more transparent about purpose Added Paths: ----------- trunk/SASxport/src/to_bigend.c trunk/SASxport/src/to_bigend.h Removed Paths: ------------- trunk/SASxport/src/host_to_be.c Deleted: trunk/SASxport/src/host_to_be.c =================================================================== --- trunk/SASxport/src/host_to_be.c 2014-07-19 03:37:50 UTC (rev 1846) +++ trunk/SASxport/src/host_to_be.c 2014-07-20 02:01:34 UTC (rev 1847) @@ -1,80 +0,0 @@ -#include "writeSAS.h" - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <assert.h> -#include <sys/types.h> - -/* host_to_be: convert current host byte order to big endian */ -void host_to_be( unsigned char *intp, size_t size) -{ - size_t i; - unsigned char tmp; - - short twobytes = 0x0001; - char onebyte = *(char*) &twobytes; - - /* Test if we are on a big endian or little endian platform */ - if (onebyte == 1) - { - /* Native byte order is little endian, so swap bytes */ - /* printf("Little Endian Machine!\n"); */ - - for(i=0; i < size/2; i++) - { - tmp = (unsigned char) intp[i]; - intp[i] = intp[size-i-1]; - intp[size-i-1] = tmp; - } - } - else - { - /* The native byte order is big endian, so do nothing */ - /* printf("Big Endian Machine!\n"); */ - } - - return; -} - -/* test code */ -void test_host_to_be() -{ - unsigned char byte_pattern[1] = { 0x00 }; - unsigned char byte_value = 0x00; - - unsigned char short_pattern[2] = { 0x01, 0x00 }; /* NB: big endian byte pattern */ - short short_value = 0x0100; /* NB: hex is also written big endian */ - - unsigned char int_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; - int int_value = 0x03020100; - - unsigned char long_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; - long long_value = 0x03020100; - - /* Do the host_to_be, then test */ - - /* byte */ - host_to_be( &byte_value, sizeof(unsigned char) ); - ASSERT( (unsigned char) *byte_pattern == byte_value ); - - /* short */ - host_to_be( (unsigned char*) &short_value, sizeof(short) ); - ASSERT( *((short *) short_pattern) == short_value ); - - /* int */ - host_to_be( (unsigned char*) &int_value, sizeof(int) ); - ASSERT( *((int *) int_pattern) == int_value ); - - /* long */ - host_to_be( (unsigned char*) &long_value, sizeof(long) ); - ASSERT( *((long*) long_pattern) == long_value ); - -} - -#ifdef DO_TEST -int main(int argc, char *argv) -{ - test_host_to_be(); -} -#endif Copied: trunk/SASxport/src/to_bigend.c (from rev 1846, trunk/SASxport/src/host_to_be.c) =================================================================== --- trunk/SASxport/src/to_bigend.c (rev 0) +++ trunk/SASxport/src/to_bigend.c 2014-07-20 02:01:34 UTC (rev 1847) @@ -0,0 +1,80 @@ +#include "writeSAS.h" + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <assert.h> +#include <sys/types.h> + +/* to_bigend: convert current host byte order to big endian */ +void to_bigend( unsigned char *intp, size_t size) +{ + size_t i; + unsigned char tmp; + + short twobytes = 0x0001; + char onebyte = *(char*) &twobytes; + + /* Test if we are on a big endian or little endian platform */ + if (onebyte == 1) + { + /* Native byte order is little endian, so swap bytes */ + /* printf("Little Endian Machine!\n"); */ + + for(i=0; i < size/2; i++) + { + tmp = (unsigned char) intp[i]; + intp[i] = intp[size-i-1]; + intp[size-i-1] = tmp; + } + } + else + { + /* The native byte order is big endian, so do nothing */ + /* printf("Big Endian Machine!\n"); */ + } + + return; +} + +/* test code */ +void test_to_bigend() +{ + unsigned char byte_pattern[1] = { 0x00 }; + unsigned char byte_value = 0x00; + + unsigned char short_pattern[2] = { 0x01, 0x00 }; /* NB: big endian byte pattern */ + short short_value = 0x0100; /* NB: hex is also written big endian */ + + unsigned char int_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; + int int_value = 0x03020100; + + unsigned char long_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; + long long_value = 0x03020100; + + /* Do the to_bigend, then test */ + + /* byte */ + to_bigend( &byte_value, sizeof(unsigned char) ); + ASSERT( (unsigned char) *byte_pattern == byte_value ); + + /* short */ + to_bigend( (unsigned char*) &short_value, sizeof(short) ); + ASSERT( *((short *) short_pattern) == short_value ); + + /* int */ + to_bigend( (unsigned char*) &int_value, sizeof(int) ); + ASSERT( *((int *) int_pattern) == int_value ); + + /* long */ + to_bigend( (unsigned char*) &long_value, sizeof(long) ); + ASSERT( *((long*) long_pattern) == long_value ); + +} + +#ifdef DO_TEST +int main(int argc, char **argv) +{ + test_to_bigend(); +} +#endif Added: trunk/SASxport/src/to_bigend.h =================================================================== --- trunk/SASxport/src/to_bigend.h (rev 0) +++ trunk/SASxport/src/to_bigend.h 2014-07-20 02:01:34 UTC (rev 1847) @@ -0,0 +1,26 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, a copy is available at + * http://www.r-project.org/Licenses/ + */ +#ifndef TO_BIGEND_H +#define TO_BIGEND_H + +void to_bigend( unsigned char *intp, size_t size); + +/* Convert (if necessary) to Big-Endian */ +#define TO_BIGEND_SHORT(a) to_bigend( (unsigned char*) &a, sizeof(short) ) +#define TO_BIGEND_INT(a) to_bigend( (unsigned char*) &a, sizeof(int) ) +#define TO_BIGEND_DOUBLE(a) to_bigend( (unsigned char*) &a, sizeof(double) ) + +#endif /* TO_BIGEND_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-19 03:37:52
|
Revision: 1846 http://sourceforge.net/p/r-gregmisc/code/1846 Author: warnes Date: 2014-07-19 03:37:50 +0000 (Sat, 19 Jul 2014) Log Message: ----------- Minor change in spacing Modified Paths: -------------- trunk/SASxport/src/writeSAS.h Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-19 03:37:05 UTC (rev 1845) +++ trunk/SASxport/src/writeSAS.h 2014-07-19 03:37:50 UTC (rev 1846) @@ -50,9 +50,9 @@ #endif /* Convert (if necessary) to Big-Endian */ -# define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) -# define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) -# define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) &a, sizeof(double) ) +#define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) +#define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) +#define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) &a, sizeof(double) ) /* Alternative definition using system functions: */ /* #define HTOBE_SHORT(a) (a) = htons( a ) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-19 03:37:14
|
Revision: 1845 http://sourceforge.net/p/r-gregmisc/code/1845 Author: warnes Date: 2014-07-19 03:37:05 +0000 (Sat, 19 Jul 2014) Log Message: ----------- Change byte-order detection code Modified Paths: -------------- trunk/SASxport/src/host_to_be.c Modified: trunk/SASxport/src/host_to_be.c =================================================================== --- trunk/SASxport/src/host_to_be.c 2014-07-19 03:31:00 UTC (rev 1844) +++ trunk/SASxport/src/host_to_be.c 2014-07-19 03:37:05 UTC (rev 1845) @@ -9,26 +9,31 @@ /* host_to_be: convert current host byte order to big endian */ void host_to_be( unsigned char *intp, size_t size) { - static unsigned char endianTest[2] = {0x01,0x00}; size_t i; unsigned char tmp; + short twobytes = 0x0001; + char onebyte = *(char*) &twobytes; + /* Test if we are on a big endian or little endian platform */ - if( (short) *endianTest != 1 ) + if (onebyte == 1) + { + /* Native byte order is little endian, so swap bytes */ + /* printf("Little Endian Machine!\n"); */ + + for(i=0; i < size/2; i++) + { + tmp = (unsigned char) intp[i]; + intp[i] = intp[size-i-1]; + intp[size-i-1] = tmp; + } + } + else { /* The native byte order is big endian, so do nothing */ - //printf("Big Endian Machine!\n"); - return; + /* printf("Big Endian Machine!\n"); */ } - - /* If native byte order is little endian, we need to swap bytes */ - for(i=0; i < size/2; i++) - { - tmp = (unsigned char) intp[i]; - intp[i] = intp[size-i-1]; - intp[size-i-1] = tmp; - } - + return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-19 03:31:03
|
Revision: 1844 http://sourceforge.net/p/r-gregmisc/code/1844 Author: warnes Date: 2014-07-19 03:31:00 +0000 (Sat, 19 Jul 2014) Log Message: ----------- Fix copy-paste error Modified Paths: -------------- trunk/SASxport/src/writeSAS.h Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-18 20:47:17 UTC (rev 1843) +++ trunk/SASxport/src/writeSAS.h 2014-07-19 03:31:00 UTC (rev 1844) @@ -50,9 +50,9 @@ #endif /* Convert (if necessary) to Big-Endian */ -# define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) -# define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) -# define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) value, sizeof(double) ); +# define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) +# define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) +# define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) &a, sizeof(double) ) /* Alternative definition using system functions: */ /* #define HTOBE_SHORT(a) (a) = htons( a ) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 20:47:21
|
Revision: 1843 http://sourceforge.net/p/r-gregmisc/code/1843 Author: warnes Date: 2014-07-18 20:47:17 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Update NEWS for SASxport 1.4.2 Modified Paths: -------------- trunk/SASxport/inst/NEWS Modified: trunk/SASxport/inst/NEWS =================================================================== --- trunk/SASxport/inst/NEWS 2014-07-18 20:40:57 UTC (rev 1842) +++ trunk/SASxport/inst/NEWS 2014-07-18 20:47:17 UTC (rev 1843) @@ -3,13 +3,20 @@ Bug fixes: -- Explicitly cast left shifts in ibm2ieee.c to avoid undefined +- Explicitly cast left bit shifts to avoid undefined C language behavior. (Reported by Brian Ripley) - Resolve problem in accessing "Hmisc::label.default<-" if SASxport::read.xport is called without loading SASxport. (Reported by Dominic Comtois) +Other changes: + +- Modified several test files to display generated .xpt data so that + issues can be more easily detected and diagnosed. + +- C code cleanup and reorgaization to improve clarity. + Version 1.4.1 - 2014-07-16 -------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 20:41:07
|
Revision: 1842 http://sourceforge.net/p/r-gregmisc/code/1842 Author: warnes Date: 2014-07-18 20:40:57 +0000 (Fri, 18 Jul 2014) Log Message: ----------- - Rename function and file 'reverse' to 'host_to_be' (short for host-endian to big-endian') to clarify purpose of the function. - Remove pre-processeor definition of REVERSE, and add definitions of HTOBE_SHORT, HTOBE_INT, and HTOBE_DOUBLE. Modified Paths: -------------- trunk/SASxport/src/writeSAS.c trunk/SASxport/src/writeSAS.h Added Paths: ----------- trunk/SASxport/src/host_to_be.c Removed Paths: ------------- trunk/SASxport/src/reverse.c Copied: trunk/SASxport/src/host_to_be.c (from rev 1825, trunk/SASxport/src/reverse.c) =================================================================== --- trunk/SASxport/src/host_to_be.c (rev 0) +++ trunk/SASxport/src/host_to_be.c 2014-07-18 20:40:57 UTC (rev 1842) @@ -0,0 +1,75 @@ +#include "writeSAS.h" + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <assert.h> +#include <sys/types.h> + +/* host_to_be: convert current host byte order to big endian */ +void host_to_be( unsigned char *intp, size_t size) +{ + static unsigned char endianTest[2] = {0x01,0x00}; + size_t i; + unsigned char tmp; + + /* Test if we are on a big endian or little endian platform */ + if( (short) *endianTest != 1 ) + { + /* The native byte order is big endian, so do nothing */ + //printf("Big Endian Machine!\n"); + return; + } + + /* If native byte order is little endian, we need to swap bytes */ + for(i=0; i < size/2; i++) + { + tmp = (unsigned char) intp[i]; + intp[i] = intp[size-i-1]; + intp[size-i-1] = tmp; + } + + return; +} + +/* test code */ +void test_host_to_be() +{ + unsigned char byte_pattern[1] = { 0x00 }; + unsigned char byte_value = 0x00; + + unsigned char short_pattern[2] = { 0x01, 0x00 }; /* NB: big endian byte pattern */ + short short_value = 0x0100; /* NB: hex is also written big endian */ + + unsigned char int_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; + int int_value = 0x03020100; + + unsigned char long_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; + long long_value = 0x03020100; + + /* Do the host_to_be, then test */ + + /* byte */ + host_to_be( &byte_value, sizeof(unsigned char) ); + ASSERT( (unsigned char) *byte_pattern == byte_value ); + + /* short */ + host_to_be( (unsigned char*) &short_value, sizeof(short) ); + ASSERT( *((short *) short_pattern) == short_value ); + + /* int */ + host_to_be( (unsigned char*) &int_value, sizeof(int) ); + ASSERT( *((int *) int_pattern) == int_value ); + + /* long */ + host_to_be( (unsigned char*) &long_value, sizeof(long) ); + ASSERT( *((long*) long_pattern) == long_value ); + +} + +#ifdef DO_TEST +int main(int argc, char *argv) +{ + test_host_to_be(); +} +#endif Deleted: trunk/SASxport/src/reverse.c =================================================================== --- trunk/SASxport/src/reverse.c 2014-07-18 18:37:51 UTC (rev 1841) +++ trunk/SASxport/src/reverse.c 2014-07-18 20:40:57 UTC (rev 1842) @@ -1,77 +0,0 @@ -#include "writeSAS.h" - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <assert.h> -#include <sys/types.h> - -/* reverse: convert current byte order to big endian */ -void reverse( unsigned char *intp, size_t size) -{ - static unsigned char endianTest[2] = {0x01,0x00}; - size_t i; - unsigned char tmp; - -#if !defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN) - /* Test if we are on a big endian or little endian platform */ - if( (short) *endianTest != 1 ) - { - /* The native byte order is big endian, so do nothing */ - //printf("Big Endian Machine!\n"); - return; - } -#endif - - /* If native byte order is little endian, we need to swap bytes */ - for(i=0; i < size/2; i++) - { - tmp = (unsigned char) intp[i]; - intp[i] = intp[size-i-1]; - intp[size-i-1] = tmp; - } - - return; -} - -/* test code */ -void test_reverse() -{ - unsigned char byte_pattern[1] = { 0x00 }; - unsigned char byte_value = 0x00; - - unsigned char short_pattern[2] = { 0x01, 0x00 }; /* NB: big endian byte pattern */ - short short_value = 0x0100; /* NB: hex is also written big endian */ - - unsigned char int_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; - int int_value = 0x03020100; - - unsigned char long_pattern[4] = { 0x03, 0x02, 0x01, 0x00 }; - long long_value = 0x03020100; - - /* Do the reverse, then test */ - - /* byte */ - reverse( &byte_value, sizeof(unsigned char) ); - ASSERT( (unsigned char) *byte_pattern == byte_value ); - - /* short */ - reverse( (unsigned char*) &short_value, sizeof(short) ); - ASSERT( *((short *) short_pattern) == short_value ); - - /* int */ - reverse( (unsigned char*) &int_value, sizeof(int) ); - ASSERT( *((int *) int_pattern) == int_value ); - - /* long */ - reverse( (unsigned char*) &long_value, sizeof(long) ); - ASSERT( *((long*) long_pattern) == long_value ); - -} - -#ifdef DO_TEST -int main(int argc, char *argv) -{ - test_reverse(); -} -#endif Modified: trunk/SASxport/src/writeSAS.c =================================================================== --- trunk/SASxport/src/writeSAS.c 2014-07-18 18:37:51 UTC (rev 1841) +++ trunk/SASxport/src/writeSAS.c 2014-07-18 20:40:57 UTC (rev 1842) @@ -260,22 +260,18 @@ zeroFill(namestr_record.rest, 52); /* remaining fields are irrelevant */ - /* Flip byte order if necessary */ -#define SHORTREV(a) REVERSE( &a, sizeof(short) ) -#define INTREV(a) REVERSE( &a, sizeof(int) ) + HTOBE_SHORT( namestr_record.ntype ); + HTOBE_SHORT( namestr_record.nhfun ); + HTOBE_SHORT( namestr_record.nlng ); + HTOBE_SHORT( namestr_record.nvar0 ); + HTOBE_SHORT( namestr_record.nfl ); + HTOBE_SHORT( namestr_record.nfd ); + HTOBE_SHORT( namestr_record.nfj ); + HTOBE_SHORT( namestr_record.nifl ); + HTOBE_SHORT( namestr_record.nifd ); - SHORTREV( namestr_record.ntype ); - SHORTREV( namestr_record.nhfun ); - SHORTREV( namestr_record.nlng ); - SHORTREV( namestr_record.nvar0 ); - SHORTREV( namestr_record.nfl ); - SHORTREV( namestr_record.nfd ); - SHORTREV( namestr_record.nfj ); - SHORTREV( namestr_record.nifl ); - SHORTREV( namestr_record.nifd ); + HTOBE_INT ( namestr_record.npos ); - INTREV ( namestr_record.npos ); - /* copy filled struct to return area */ memcpy( raw_buffer, &namestr_record, sizeof(namestr_record) ); @@ -309,7 +305,10 @@ { /* convert to IBM floating point */ - reverse( (unsigned char*) value, sizeof(double) ); + /* first convert to big-endian layout */ + HTOBE_DOUBLE( value ); + + /* now convert to ibm flaoting point format */ ieee2ibm( (unsigned char *) raw_buffer, (unsigned char *) value, 1); //cnxptiee( (char *) value, 0, raw_buffer , 1 ); Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-18 18:37:51 UTC (rev 1841) +++ trunk/SASxport/src/writeSAS.h 2014-07-18 20:40:57 UTC (rev 1842) @@ -39,17 +39,6 @@ #define MISSING 0x2e000000 /* Standard SAS missing value: '.' */ /***** - REVERSE macro, used as a wrapper for the reverse() function to avoid - compiling/calling it on big-endian, where it is a NOOP. - *****/ - -#if ( defined(BIG_ENDIAN) && BIG_ENDIAN ) || ( defined(LITTLE_ENDIAN) && !LITTLE_ENDIAN ) -# define REVERSE(a,b) ( a ) -#else -# define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b ) -#endif - -/***** * Useful macro functions *****/ @@ -60,7 +49,15 @@ #define ASSERT(x) if(!(x)) error("Assertion failed: x") #endif +/* Convert (if necessary) to Big-Endian */ +# define HTOBE_SHORT(a) host_to_be( (unsigned char*) &a, sizeof(short) ) +# define HTOBE_INT(a) host_to_be( (unsigned char*) &a, sizeof(int) ) +# define HTOBE_DOUBLE(a) host_to_be( (unsigned char*) value, sizeof(double) ); +/* Alternative definition using system functions: */ +/* #define HTOBE_SHORT(a) (a) = htons( a ) */ +/* #define HTOBE_INT(a) (a) = htonl( a ) */ + /***** * File Record Structures *****/ @@ -175,7 +172,7 @@ void doTest(); -void reverse( unsigned char *intp, size_t size); +void host_to_be( unsigned char *intp, size_t size); void ieee2ibm(register unsigned char *out, register const unsigned char *in, int count); #endif /* FIELDS_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 18:38:00
|
Revision: 1841 http://sourceforge.net/p/r-gregmisc/code/1841 Author: warnes Date: 2014-07-18 18:37:51 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Make sure all left shifts are explicitly typed as unsigned in to avoid undefined behavior. Modified Paths: -------------- trunk/SASxport/src/ieee2ibm.c Modified: trunk/SASxport/src/ieee2ibm.c =================================================================== --- trunk/SASxport/src/ieee2ibm.c 2014-07-18 17:11:52 UTC (rev 1840) +++ trunk/SASxport/src/ieee2ibm.c 2014-07-18 18:37:51 UTC (rev 1841) @@ -45,95 +45,111 @@ static char numeric_NA[8] = {0x2e,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - /* - * IBM Format. - * 7-bit exponent, base 16. - * No hidden bits in mantissa (56 bits). - */ - register int i; - for( i=count-1; i >= 0; i-- ) { - register unsigned int left, right; - register int fix, exp, signbit; + /* + * IBM Format. + * 7-bit exponent, base 16. + * No hidden bits in mantissa (56 bits). + */ + register int i; + for( i=count-1; i >= 0; i-- ) + { + register unsigned int left, right; + register int fix, exp, signbit; - left = (in[0]<<24) | (in[1]<<16) | (in[2]<<8) | in[3]; - right = (in[4]<<24) | (in[5]<<16) | (in[6]<<8) | in[7]; - in += 8; + left = ( (unsigned int) in[0]<<24) | + ( (unsigned int) in[1]<<16) | + ( (unsigned int) in[2]<<8 ) | + in[3]; + right = ( (unsigned int) in[4]<<24) | + ( (unsigned int) in[5]<<16) | + ( (unsigned int) in[6]<<8 ) | + in[7]; + in += 8; - exp = ((left >> 20) & 0x7FF); - signbit = (left & 0x80000000) >> 24; + exp = ((left >> 20) & 0x7FF); + signbit = (left & 0x80000000) >> 24; - if( exp == 0 || exp == 0x7FF ) { - *out++ = 0; /* IBM zero. No NAN */ - *out++ = 0; - *out++ = 0; - *out++ = 0; - *out++ = 0; - *out++ = 0; - *out++ = 0; - *out++ = 0; - continue; - } + if( exp == 0 || exp == 0x7FF ) + { + *out++ = 0; /* IBM zero. No NAN */ + *out++ = 0; + *out++ = 0; + *out++ = 0; + *out++ = 0; + *out++ = 0; + *out++ = 0; + *out++ = 0; + continue; + } - left = (left & 0x000FFFFF) | 0x00100000;/* replace "hidden" bit */ + left = (left & 0x000FFFFF) | 0x00100000;/* replace "hidden" bit */ - exp += 129 - 1023 -1; /* fudge, to make /4 and %4 work */ - fix = exp % 4; /* 2^4 == 16^1; get fractional exp */ - exp /= 4; /* excess 32, base 16 */ - exp += (64-32+1); /* excess 64, base 16, plus fudge */ - if( (exp & ~0xFF) != 0 ) { - warning("IBM exponent overflow, generating NA\n"); - memcpy(out, numeric_NA, 8); - out+= 8; - continue; - } + exp += 129 - 1023 -1; /* fudge, to make /4 and %4 work */ + fix = exp % 4; /* 2^4 == 16^1; get fractional exp */ + exp /= 4; /* excess 32, base 16 */ + exp += (64-32+1); /* excess 64, base 16, plus fudge */ + if( (exp & ~0xFF) != 0 ) + { + warning("IBM exponent overflow, generating NA\n"); + memcpy(out, numeric_NA, 8); + out+= 8; + continue; + } - if( fix ) { - left = (left<<fix) | (right >> (32-fix)); - right <<= fix; - } + if( fix ) + { + left = ( (unsigned int) left<<fix) | (right >> (32-fix)); + right <<= fix; + } - /* if( 0 && signbit ) { */ - if( 0 ) { - /* The IBM actually uses complimented mantissa - * and exponent. - */ - left ^= 0xFFFFFFFF; - right ^= 0xFFFFFFFF; - if( right & 0x80000000 ) { - /* There may be a carry */ - right += 1; - if( (right & 0x80000000) == 0 ) { - /* There WAS a carry */ - left += 1; - } - } else { - /* There will be no carry to worry about */ - right += 1; - } - left &= 0x00FFFFFF; - exp = (~exp) & 0x7F; + /* if( 0 && signbit ) { */ + if( 0 ) + { + /* The IBM actually uses complimented mantissa + * and exponent. + */ + left ^= 0xFFFFFFFF; + right ^= 0xFFFFFFFF; + if( right & 0x80000000 ) + { + /* There may be a carry */ + right += 1; + if( (right & 0x80000000) == 0 ) + { + /* There WAS a carry */ + left += 1; } + } + else + { + /* There will be no carry to worry about */ + right += 1; + } + left &= 0x00FFFFFF; + exp = (~exp) & 0x7F; + } - /* Not actually required, but for comparison purposes, - * normalize the number. Remove for production speed. - */ - while( (left & 0x00F00000) == 0 && left != 0 ) { - if( signbit && exp <= 0x41 ) break; + /* Not actually required, but for comparison purposes, + * normalize the number. Remove for production speed. + */ + while( (left & 0x00F00000) == 0 && left != 0 ) + { + if( signbit && exp <= 0x41 ) break; - left = (left << 4) | (right >> (32-4)); - right <<= 4; - if(signbit) exp--; - else exp++; - } + left = ( (unsigned int) left << 4) | (right >> (32-4)); + right <<= 4; + if(signbit) exp--; + else exp++; + } - *out++ = signbit | exp; - *out++ = left>>16; - *out++ = left>>8; - *out++ = left; - *out++ = right>>24; - *out++ = right>>16; - *out++ = right>>8; - *out++ = right; - } - return; + *out++ = signbit | exp; + *out++ = left>>16; + *out++ = left>>8; + *out++ = left; + *out++ = right>>24; + *out++ = right>>16; + *out++ = right>>8; + *out++ = right; + } + return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 17:12:04
|
Revision: 1840 http://sourceforge.net/p/r-gregmisc/code/1840 Author: warnes Date: 2014-07-18 17:11:52 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Update test output Modified Paths: -------------- trunk/SASxport/tests/Alfalfa_Test.R trunk/SASxport/tests/Alfalfa_Test.Rout.save trunk/SASxport/tests/Theoph.Rout.save trunk/SASxport/tests/cars.R trunk/SASxport/tests/cars.Rout.save trunk/SASxport/tests/testDates.Rout.save trunk/SASxport/tests/testDuplicateNames.Rout.save trunk/SASxport/tests/testEmpty.Rout.save trunk/SASxport/tests/testExamples.Rout.save trunk/SASxport/tests/testManyNames.Rout.save trunk/SASxport/tests/testNegative.Rout.save trunk/SASxport/tests/testNumeric.Rout.save trunk/SASxport/tests/testUnnamedComponents.Rout.save trunk/SASxport/tests/test_as_is.Rout.save trunk/SASxport/tests/test_fields.Rout.save trunk/SASxport/tests/xport.Rout.save trunk/SASxport/tests/xxx.R trunk/SASxport/tests/xxx.Rout.save Modified: trunk/SASxport/tests/Alfalfa_Test.R =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.R 2014-07-18 17:04:07 UTC (rev 1839) +++ trunk/SASxport/tests/Alfalfa_Test.R 2014-07-18 17:11:52 UTC (rev 1840) @@ -16,12 +16,20 @@ autogen.formats=FALSE ) +## Display for diff +write.xport(SPEC, + file="", # display inline + cDate=strptime("10DEC99:15:56:30", format="%d%b%y:%H:%M:%S"), + osType="OSF1", + sasVer="7.00", + autogen.formats=FALSE, + verbose=TRUE + ) + + ## Load both files back in as raw data a.1 <- readBin( con="Alfalfa.xpt", what=raw(), n=3600 ) a.2 <- readBin( con="Alfalfa2.xpt", what=raw(), n=3600 ) -## Display for diff -a.2 - ## Test that the files are identical stopifnot( all(a.1 == a.2) ) Modified: trunk/SASxport/tests/Alfalfa_Test.Rout.save =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-18 17:04:07 UTC (rev 1839) +++ trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-18 17:11:52 UTC (rev 1840) @@ -52,163 +52,794 @@ + autogen.formats=FALSE + ) > +> ## Display for diff +> write.xport(SPEC, ++ file="", # display inline ++ cDate=strptime("10DEC99:15:56:30", format="%d%b%y:%H:%M:%S"), ++ osType="OSF1", ++ sasVer="7.00", ++ autogen.formats=FALSE, ++ verbose=TRUE ++ ) +### Ensure all objects to be stored are data.frames... + ### +### Ensure object names are valid and unique... + ### +### opening file ... ### +### Done ### +### Write file header ... ### +ASCII: HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000 SAS SAS SASLIB 7.00 OSF1.... 10DEC99:15:56:3010DEC99:15:56:30 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 53 41 53 4c 49 42 20 20 37 2e 30 30 20 20 20 20 4f 53 46 31 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +### Done. ### +### Write data frame header ... ### +ASCII: HEADER RECORD*******MEMBER HEADER RECORD!!!!!!!000000000000000001600000000140 HEADER RECORD*******DSCRPTR HEADER RECORD!!!!!!!000000000000000000000000000000 SAS SPEC SASDATA 7.00 OSF1.... 10DEC99:15:56:3010DEC99:15:56:30 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 50 45 43 20 20 20 20 53 41 53 44 41 54 41 20 37 2e 30 30 20 20 20 20 4f 53 46 31 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +### Done. ### +### Write variable information block header ... ### +ASCII: HEADER RECORD*******NAMESTR HEADER RECORD!!!!!!!000000000600000000000000000000 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 36 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 +### Done. ### +### Write entries for variable information block ... ### +### POP ... ### +ASCII: ........POP ........ ............................................................ +HEX: 00 02 00 00 00 08 00 01 50 4f 50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### SAMPLE ... ### +ASCII: ........SAMPLE ........ ............................................................ +HEX: 00 01 00 00 00 08 00 02 53 41 4d 50 4c 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### REP ... ### +ASCII: ........REP ........ ............................................................ +HEX: 00 01 00 00 00 08 00 03 52 45 50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### SEEDWT ... ### +ASCII: ........SEEDWT ........ ............................................................ +HEX: 00 01 00 00 00 08 00 04 53 45 45 44 57 54 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### HARV1 ... ### +ASCII: ........HARV1 ........ ....... .................................................... +HEX: 00 01 00 00 00 08 00 05 48 41 52 56 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### HARV2 ... ### +ASCII: ........HARV2 ........ .......(.................................................... +HEX: 00 01 00 00 00 08 00 06 48 41 52 56 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### Done. ### +ASCII: +HEX: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +### Write header for data block ... ### +ASCII: HEADER RECORD*******OBS HEADER RECORD!!!!!!!000000000000000000000000000000 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4f 42 53 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 +### Done ### +### Write data ... ### +### i= 1 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 1 j= 2 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 1 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 1 j= 4 value= 64 len= 8 ### +ASCII: B@...... +HEX: 42 40 00 00 00 00 00 00 +### i= 1 j= 5 value= 171.7 len= 8 ### +ASCII: B..33330 +HEX: 42 ab b3 33 33 33 33 30 +### i= 1 j= 6 value= 180.3 len= 8 ### +ASCII: B.L..... +HEX: 42 b4 4c cc cc cc cc d0 +### i= 2 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 2 j= 2 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 2 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 2 j= 4 value= 54 len= 8 ### +ASCII: B6...... +HEX: 42 36 00 00 00 00 00 00 +### i= 2 j= 5 value= 138.2 len= 8 ### +ASCII: B.333330 +HEX: 42 8a 33 33 33 33 33 30 +### i= 2 j= 6 value= 150.7 len= 8 ### +ASCII: B..33330 +HEX: 42 96 b3 33 33 33 33 30 +### i= 3 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 3 j= 2 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 3 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 3 j= 4 value= 40 len= 8 ### +ASCII: B(...... +HEX: 42 28 00 00 00 00 00 00 +### i= 3 j= 5 value= 145.6 len= 8 ### +ASCII: B....... +HEX: 42 91 99 99 99 99 99 98 +### i= 3 j= 6 value= 129.1 len= 8 ### +ASCII: B....... +HEX: 42 81 19 99 99 99 99 98 +### i= 4 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 4 j= 2 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 4 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 4 j= 4 value= 45 len= 8 ### +ASCII: B-...... +HEX: 42 2d 00 00 00 00 00 00 +### i= 4 j= 5 value= 170.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 aa 66 66 66 66 66 68 +### i= 4 j= 6 value= 191.2 len= 8 ### +ASCII: B.333330 +HEX: 42 bf 33 33 33 33 33 30 +### i= 5 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 5 j= 2 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 5 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 5 j= 4 value= 64 len= 8 ### +ASCII: B@...... +HEX: 42 40 00 00 00 00 00 00 +### i= 5 j= 5 value= 124.8 len= 8 ### +ASCII: B|...... +HEX: 42 7c cc cc cc cc cc cc +### i= 5 j= 6 value= 172.6 len= 8 ### +ASCII: B....... +HEX: 42 ac 99 99 99 99 99 98 +### i= 6 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 6 j= 2 value= 5 len= 8 ### +ASCII: AP...... +HEX: 41 50 00 00 00 00 00 00 +### i= 6 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 6 j= 4 value= 75 len= 8 ### +ASCII: BK...... +HEX: 42 4b 00 00 00 00 00 00 +### i= 6 j= 5 value= 179 len= 8 ### +ASCII: B....... +HEX: 42 b3 00 00 00 00 00 00 +### i= 6 j= 6 value= 235.3 len= 8 ### +ASCII: B.L..... +HEX: 42 eb 4c cc cc cc cc d0 +### i= 7 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 7 j= 2 value= 6 len= 8 ### +ASCII: A`...... +HEX: 41 60 00 00 00 00 00 00 +### i= 7 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 7 j= 4 value= 45 len= 8 ### +ASCII: B-...... +HEX: 42 2d 00 00 00 00 00 00 +### i= 7 j= 5 value= 166.3 len= 8 ### +ASCII: B.L..... +HEX: 42 a6 4c cc cc cc cc d0 +### i= 7 j= 6 value= 173.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 ad e6 66 66 66 66 68 +### i= 8 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 8 j= 2 value= 7 len= 8 ### +ASCII: Ap...... +HEX: 41 70 00 00 00 00 00 00 +### i= 8 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 8 j= 4 value= 63 len= 8 ### +ASCII: B?...... +HEX: 42 3f 00 00 00 00 00 00 +### i= 8 j= 5 value= 169.7 len= 8 ### +ASCII: B..33330 +HEX: 42 a9 b3 33 33 33 33 30 +### i= 8 j= 6 value= 155.8 len= 8 ### +ASCII: B....... +HEX: 42 9b cc cc cc cc cc d0 +### i= 9 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 9 j= 2 value= 8 len= 8 ### +ASCII: A....... +HEX: 41 80 00 00 00 00 00 00 +### i= 9 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 9 j= 4 value= 65 len= 8 ### +ASCII: BA...... +HEX: 42 41 00 00 00 00 00 00 +### i= 9 j= 5 value= 192.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 c0 e6 66 66 66 66 68 +### i= 9 j= 6 value= 177.6 len= 8 ### +ASCII: B....... +HEX: 42 b1 99 99 99 99 99 98 +### i= 10 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 10 j= 2 value= 9 len= 8 ### +ASCII: A....... +HEX: 41 90 00 00 00 00 00 00 +### i= 10 j= 3 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 10 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 10 j= 5 value= 185.8 len= 8 ### +ASCII: B....... +HEX: 42 b9 cc cc cc cc cc d0 +### i= 10 j= 6 value= 179.2 len= 8 ### +ASCII: B.333330 +HEX: 42 b3 33 33 33 33 33 30 +### i= 11 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 11 j= 2 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 11 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 11 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 11 j= 5 value= 158.8 len= 8 ### +ASCII: B....... +HEX: 42 9e cc cc cc cc cc d0 +### i= 11 j= 6 value= 139.7 len= 8 ### +ASCII: B..33330 +HEX: 42 8b b3 33 33 33 33 30 +### i= 12 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 12 j= 2 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 12 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 12 j= 4 value= 46 len= 8 ### +ASCII: B....... +HEX: 42 2e 00 00 00 00 00 00 +### i= 12 j= 5 value= 163.7 len= 8 ### +ASCII: B..33330 +HEX: 42 a3 b3 33 33 33 33 30 +### i= 12 j= 6 value= 150 len= 8 ### +ASCII: B....... +HEX: 42 96 00 00 00 00 00 00 +### i= 13 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 13 j= 2 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 13 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 13 j= 4 value= 42 len= 8 ### +ASCII: B*...... +HEX: 42 2a 00 00 00 00 00 00 +### i= 13 j= 5 value= 120.6 len= 8 ### +ASCII: Bx...... +HEX: 42 78 99 99 99 99 99 98 +### i= 13 j= 6 value= 131.1 len= 8 ### +ASCII: B....... +HEX: 42 83 19 99 99 99 99 98 +### i= 14 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 14 j= 2 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 14 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 14 j= 4 value= 38 len= 8 ### +ASCII: B&...... +HEX: 42 26 00 00 00 00 00 00 +### i= 14 j= 5 value= 193.1 len= 8 ### +ASCII: B....... +HEX: 42 c1 19 99 99 99 99 98 +### i= 14 j= 6 value= 195.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 c3 66 66 66 66 66 68 +### i= 15 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 15 j= 2 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 15 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 15 j= 4 value= 54 len= 8 ### +ASCII: B6...... +HEX: 42 36 00 00 00 00 00 00 +### i= 15 j= 5 value= 171.5 len= 8 ### +ASCII: B....... +HEX: 42 ab 80 00 00 00 00 00 +### i= 15 j= 6 value= 167.6 len= 8 ### +ASCII: B....... +HEX: 42 a7 99 99 99 99 99 98 +### i= 16 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 16 j= 2 value= 5 len= 8 ### +ASCII: AP...... +HEX: 41 50 00 00 00 00 00 00 +### i= 16 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 16 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 16 j= 5 value= 181.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 b5 66 66 66 66 66 68 +### i= 16 j= 6 value= 152.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 98 e6 66 66 66 66 68 +### i= 17 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 17 j= 2 value= 6 len= 8 ### +ASCII: A`...... +HEX: 41 60 00 00 00 00 00 00 +### i= 17 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 17 j= 4 value= 60 len= 8 ### +ASCII: B<...... +HEX: 42 3c 00 00 00 00 00 00 +### i= 17 j= 5 value= 165.3 len= 8 ### +ASCII: B.L..... +HEX: 42 a5 4c cc cc cc cc d0 +### i= 17 j= 6 value= 167.5 len= 8 ### +ASCII: B....... +HEX: 42 a7 80 00 00 00 00 00 +### i= 18 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 18 j= 2 value= 7 len= 8 ### +ASCII: Ap...... +HEX: 41 70 00 00 00 00 00 00 +### i= 18 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 18 j= 4 value= 63 len= 8 ### +ASCII: B?...... +HEX: 42 3f 00 00 00 00 00 00 +### i= 18 j= 5 value= 163.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 a3 e6 66 66 66 66 68 +### i= 18 j= 6 value= 158 len= 8 ### +ASCII: B....... +HEX: 42 9e 00 00 00 00 00 00 +### i= 19 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 19 j= 2 value= 8 len= 8 ### +ASCII: A....... +HEX: 41 80 00 00 00 00 00 00 +### i= 19 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 19 j= 4 value= 70 len= 8 ### +ASCII: BF...... +HEX: 42 46 00 00 00 00 00 00 +### i= 19 j= 5 value= 152.5 len= 8 ### +ASCII: B....... +HEX: 42 98 80 00 00 00 00 00 +### i= 19 j= 6 value= 150.2 len= 8 ### +ASCII: B.333330 +HEX: 42 96 33 33 33 33 33 30 +### i= 20 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 20 j= 2 value= 9 len= 8 ### +ASCII: A....... +HEX: 41 90 00 00 00 00 00 00 +### i= 20 j= 3 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 20 j= 4 value= 62 len= 8 ### +ASCII: B>...... +HEX: 42 3e 00 00 00 00 00 00 +### i= 20 j= 5 value= 173.5 len= 8 ### +ASCII: B....... +HEX: 42 ad 80 00 00 00 00 00 +### i= 20 j= 6 value= 190.7 len= 8 ### +ASCII: B..33330 +HEX: 42 be b3 33 33 33 33 30 +### i= 21 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 21 j= 2 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 21 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 21 j= 4 value= 60 len= 8 ### +ASCII: B<...... +HEX: 42 3c 00 00 00 00 00 00 +### i= 21 j= 5 value= 147.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 93 e6 66 66 66 66 68 +### i= 21 j= 6 value= 164.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 a4 e6 66 66 66 66 68 +### i= 22 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 22 j= 2 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 22 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 22 j= 4 value= 42 len= 8 ### +ASCII: B*...... +HEX: 42 2a 00 00 00 00 00 00 +### i= 22 j= 5 value= 181.3 len= 8 ### +ASCII: B.L..... +HEX: 42 b5 4c cc cc cc cc d0 +### i= 22 j= 6 value= 151.5 len= 8 ### +ASCII: B....... +HEX: 42 97 80 00 00 00 00 00 +### i= 23 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 23 j= 2 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 23 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 23 j= 4 value= 35 len= 8 ### +ASCII: B#...... +HEX: 42 23 00 00 00 00 00 00 +### i= 23 j= 5 value= 124.3 len= 8 ### +ASCII: B|L..... +HEX: 42 7c 4c cc cc cc cc cc +### i= 23 j= 6 value= 134.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 86 66 66 66 66 66 68 +### i= 24 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 24 j= 2 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 24 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 24 j= 4 value= 47 len= 8 ### +ASCII: B/...... +HEX: 42 2f 00 00 00 00 00 00 +### i= 24 j= 5 value= 174.8 len= 8 ### +ASCII: B....... +HEX: 42 ae cc cc cc cc cc d0 +### i= 24 j= 6 value= 200.8 len= 8 ### +ASCII: B....... +HEX: 42 c8 cc cc cc cc cc d0 +### i= 25 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 25 j= 2 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 25 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 25 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 25 j= 5 value= 167.8 len= 8 ### +ASCII: B....... +HEX: 42 a7 cc cc cc cc cc d0 +### i= 25 j= 6 value= 178.3 len= 8 ### +ASCII: B.L..... +HEX: 42 b2 4c cc cc cc cc d0 +### i= 26 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 26 j= 2 value= 5 len= 8 ### +ASCII: AP...... +HEX: 41 50 00 00 00 00 00 00 +### i= 26 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 26 j= 4 value= 57 len= 8 ### +ASCII: B9...... +HEX: 42 39 00 00 00 00 00 00 +### i= 26 j= 5 value= 193.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 c1 66 66 66 66 66 68 +### i= 26 j= 6 value= 183.5 len= 8 ### +ASCII: B....... +HEX: 42 b7 80 00 00 00 00 00 +### i= 27 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 27 j= 2 value= 6 len= 8 ### +ASCII: A`...... +HEX: 41 60 00 00 00 00 00 00 +### i= 27 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 27 j= 4 value= 60 len= 8 ### +ASCII: B<...... +HEX: 42 3c 00 00 00 00 00 00 +### i= 27 j= 5 value= 150.7 len= 8 ### +ASCII: B..33330 +HEX: 42 96 b3 33 33 33 33 30 +### i= 27 j= 6 value= 147.1 len= 8 ### +ASCII: B....... +HEX: 42 93 19 99 99 99 99 98 +### i= 28 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 28 j= 2 value= 7 len= 8 ### +ASCII: Ap...... +HEX: 41 70 00 00 00 00 00 00 +### i= 28 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 28 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 28 j= 5 value= 142.5 len= 8 ### +ASCII: B....... +HEX: 42 8e 80 00 00 00 00 00 +### i= 28 j= 6 value= 148.7 len= 8 ### +ASCII: B..33330 +HEX: 42 94 b3 33 33 33 33 30 +### i= 29 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 29 j= 2 value= 8 len= 8 ### +ASCII: A....... +HEX: 41 80 00 00 00 00 00 00 +### i= 29 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 29 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 29 j= 5 value= 176.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 b0 66 66 66 66 66 68 +### i= 29 j= 6 value= 204.8 len= 8 ### +ASCII: B....... +HEX: 42 cc cc cc cc cc cc d0 +### i= 30 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 30 j= 2 value= 9 len= 8 ### +ASCII: A....... +HEX: 41 90 00 00 00 00 00 00 +### i= 30 j= 3 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 30 j= 4 value= 70 len= 8 ### +ASCII: BF...... +HEX: 42 46 00 00 00 00 00 00 +### i= 30 j= 5 value= 144.2 len= 8 ### +ASCII: B.333330 +HEX: 42 90 33 33 33 33 33 30 +### i= 30 j= 6 value= 143.8 len= 8 ### +ASCII: B....... +HEX: 42 8f cc cc cc cc cc d0 +### i= 31 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 31 j= 2 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 31 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 31 j= 4 value= 61 len= 8 ### +ASCII: B=...... +HEX: 42 3d 00 00 00 00 00 00 +### i= 31 j= 5 value= 148.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 94 66 66 66 66 66 68 +### i= 31 j= 6 value= 168.8 len= 8 ### +ASCII: B....... +HEX: 42 a8 cc cc cc cc cc d0 +### i= 32 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 32 j= 2 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 32 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 32 j= 4 value= 52 len= 8 ### +ASCII: B4...... +HEX: 42 34 00 00 00 00 00 00 +### i= 32 j= 5 value= 164.9 len= 8 ### +ASCII: B..ffffh +HEX: 42 a4 e6 66 66 66 66 68 +### i= 32 j= 6 value= 158.6 len= 8 ### +ASCII: B....... +HEX: 42 9e 99 99 99 99 99 98 +### i= 33 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 33 j= 2 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 33 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 33 j= 4 value= 43 len= 8 ### +ASCII: B+...... +HEX: 42 2b 00 00 00 00 00 00 +### i= 33 j= 5 value= 141.2 len= 8 ### +ASCII: B.333330 +HEX: 42 8d 33 33 33 33 33 30 +### i= 33 j= 6 value= 158.1 len= 8 ### +ASCII: B....... +HEX: 42 9e 19 99 99 99 99 98 +### i= 34 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 34 j= 2 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 34 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 34 j= 4 value= 49 len= 8 ### +ASCII: B1...... +HEX: 42 31 00 00 00 00 00 00 +### i= 34 j= 5 value= 176.5 len= 8 ### +ASCII: B....... +HEX: 42 b0 80 00 00 00 00 00 +### i= 34 j= 6 value= 208.3 len= 8 ### +ASCII: B.L..... +HEX: 42 d0 4c cc cc cc cc d0 +### i= 35 j= 1 value= min len= 8 ### +ASCII: min +HEX: 6d 69 6e 20 20 20 20 20 +### i= 35 j= 2 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 35 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 35 j= 4 value= 60 len= 8 ### +ASCII: B<...... +HEX: 42 3c 00 00 00 00 00 00 +### i= 35 j= 5 value= 177.5 len= 8 ### +ASCII: B....... +HEX: 42 b1 80 00 00 00 00 00 +### i= 35 j= 6 value= 137.1 len= 8 ### +ASCII: B....... +HEX: 42 89 19 99 99 99 99 98 +### i= 36 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 36 j= 2 value= 5 len= 8 ### +ASCII: AP...... +HEX: 41 50 00 00 00 00 00 00 +### i= 36 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 36 j= 4 value= 59 len= 8 ### +ASCII: B;...... +HEX: 42 3b 00 00 00 00 00 00 +### i= 36 j= 5 value= 174.1 len= 8 ### +ASCII: B....... +HEX: 42 ae 19 99 99 99 99 98 +### i= 36 j= 6 value= 160.2 len= 8 ### +ASCII: B.333330 +HEX: 42 a0 33 33 33 33 33 30 +### i= 37 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 37 j= 2 value= 6 len= 8 ### +ASCII: A`...... +HEX: 41 60 00 00 00 00 00 00 +### i= 37 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 37 j= 4 value= 48 len= 8 ### +ASCII: B0...... +HEX: 42 30 00 00 00 00 00 00 +### i= 37 j= 5 value= 155.5 len= 8 ### +ASCII: B....... +HEX: 42 9b 80 00 00 00 00 00 +### i= 37 j= 6 value= 185.8 len= 8 ### +ASCII: B....... +HEX: 42 b9 cc cc cc cc cc d0 +### i= 38 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 38 j= 2 value= 7 len= 8 ### +ASCII: Ap...... +HEX: 41 70 00 00 00 00 00 00 +### i= 38 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 38 j= 4 value= 61 len= 8 ### +ASCII: B=...... +HEX: 42 3d 00 00 00 00 00 00 +### i= 38 j= 5 value= 186.7 len= 8 ### +ASCII: B..33330 +HEX: 42 ba b3 33 33 33 33 30 +### i= 38 j= 6 value= 157.7 len= 8 ### +ASCII: B..33330 +HEX: 42 9d b3 33 33 33 33 30 +### i= 39 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 39 j= 2 value= 8 len= 8 ### +ASCII: A....... +HEX: 41 80 00 00 00 00 00 00 +### i= 39 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 39 j= 4 value= 64 len= 8 ### +ASCII: B@...... +HEX: 42 40 00 00 00 00 00 00 +### i= 39 j= 5 value= 162.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 a2 66 66 66 66 66 68 +### i= 39 j= 6 value= 179.4 len= 8 ### +ASCII: B.fffffh +HEX: 42 b3 66 66 66 66 66 68 +### i= 40 j= 1 value= MAX len= 8 ### +ASCII: MAX +HEX: 4d 41 58 20 20 20 20 20 +### i= 40 j= 2 value= 9 len= 8 ### +ASCII: A....... +HEX: 41 90 00 00 00 00 00 00 +### i= 40 j= 3 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 40 j= 4 value= 71 len= 8 ### +ASCII: BG...... +HEX: 42 47 00 00 00 00 00 00 +### i= 40 j= 5 value= 141 len= 8 ### +ASCII: B....... +HEX: 42 8d 00 00 00 00 00 00 +### i= 40 j= 6 value= 161.5 len= 8 ### +ASCII: B....... +HEX: 42 a1 80 00 00 00 00 00 +ASCII: +HEX: +### Done. ### +### Closing file ... ### +### Done ### +> +> > ## Load both files back in as raw data > a.1 <- readBin( con="Alfalfa.xpt", what=raw(), n=3600 ) > a.2 <- readBin( con="Alfalfa2.xpt", what=raw(), n=3600 ) > -> ## Display for diff -> a.2 - [1] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 - [25] 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 - [49] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 - [73] 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 - [97] 53 41 53 4c 49 42 20 20 37 2e 30 30 20 20 20 20 4f 53 46 31 00 00 00 00 - [121] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [145] 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 31 30 44 45 43 39 39 3a - [169] 31 35 3a 35 36 3a 33 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [193] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [217] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [241] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 - [265] 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 - [289] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 - [313] 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a - [337] 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 - [361] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 - [385] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 - [409] 53 50 45 43 20 20 20 20 53 41 53 44 41 54 41 20 37 2e 30 30 20 20 20 20 - [433] 4f 53 46 31 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [457] 20 20 20 20 20 20 20 20 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 - [481] 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 20 20 20 20 20 20 20 20 - [505] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [529] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [553] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a - [577] 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 - [601] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 36 30 30 30 30 30 30 - [625] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 00 02 00 00 00 08 00 01 - [649] 50 4f 50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [673] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [697] 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 - [721] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - [745] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - [769] 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 08 00 02 53 41 4d 50 - [793] 4c 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [817] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [841] 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 - [865] 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - [889] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - [913] 00 00 00 00 00 00 00 00 00 01 00 00 00 08 00 03 52 45 50 20 20 20 20 20 - [937] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [961] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 - [985] 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 10 -[1009] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -[1033] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -[1057] 00 00 00 00 00 01 00 00 00 08 00 04 53 45 45 44 57 54 20 20 20 20 20 20 -[1081] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -[1105] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 -[1129] 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 18 00 00 00 00 -[1153] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -[1177] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -[1201] 00 01 00 00 00 08 00 05 48 41 52 56 31 20 20 20 20 20 20 20 20 20 20 20 -[1225] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -[1249] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 -[1273] 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 -[1297] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -[1321] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 -[1345] 00 08 00 06 48 41 52 56 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -[1369] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -[1393] 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 -[1417] 20 20 20 20 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 -[1441] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -[1465] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 -[1489] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 -[1513] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a -[1537] 2a 2a 2a 2a 4f 42 53 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 -[1561] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 -[1585] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 6d 69 6e 20 20 20 20 20 -[1609] 00 00 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 40 00 00 00 00 00 00 -[1633] 42 ab b3 33 33 33 33 30 42 b4 4c cc cc cc cc d0 6d 69 6e 20 20 20 20 20 -[1657] 41 10 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 36 00 00 00 00 00 00 -[1681] 42 8a 33 33 33 33 33 30 42 96 b3 33 33 33 33 30 6d 69 6e 20 20 20 20 20 -[1705] 41 20 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 28 00 00 00 00 00 00 -[1729] 42 91 99 99 99 99 99 98 42 81 19 99 99 99 99 98 6d 69 6e 20 20 20 20 20 -[1753] 41 30 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 2d 00 00 00 00 00 00 -[1777] 42 aa 66 66 66 66 66 68 42 bf 33 33 33 33 33 30 6d 69 6e 20 20 20 20 20 -[1801] 41 40 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 40 00 00 00 00 00 00 -[1825] 42 7c cc cc cc cc cc cc 42 ac 99 99 99 99 99 98 4d 41 58 20 20 20 20 20 -[1849] 41 50 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 4b 00 00 00 00 00 00 -[1873] 42 b3 00 00 00 00 00 00 42 eb 4c cc cc cc cc d0 4d 41 58 20 20 20 20 20 -[1897] 41 60 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 2d 00 00 00 00 00 00 -[1921] 42 a6 4c cc cc cc cc d0 42 ad e6 66 66 66 66 68 4d 41 58 20 20 20 20 20 -[1945] 41 70 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 3f 00 00 00 00 00 00 -[1969] 42 a9 b3 33 33 33 33 30 42 9b cc cc cc cc cc d0 4d 41 58 20 20 20 20 20 -[1993] 41 80 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 41 00 00 00 00 00 00 -[2017] 42 c0 e6 66 66 66 66 68 42 b1 99 99 99 99 99 98 4d 41 58 20 20 20 20 20 -[2041] 41 90 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[2065] 42 b9 cc cc cc cc cc d0 42 b3 33 33 33 33 33 30 6d 69 6e 20 20 20 20 20 -[2089] 00 00 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[2113] 42 9e cc cc cc cc cc d0 42 8b b3 33 33 33 33 30 6d 69 6e 20 20 20 20 20 -[2137] 41 10 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 2e 00 00 00 00 00 00 -[2161] 42 a3 b3 33 33 33 33 30 42 96 00 00 00 00 00 00 6d 69 6e 20 20 20 20 20 -[2185] 41 20 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 2a 00 00 00 00 00 00 -[2209] 42 78 99 99 99 99 99 98 42 83 19 99 99 99 99 98 6d 69 6e 20 20 20 20 20 -[2233] 41 30 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 26 00 00 00 00 00 00 -[2257] 42 c1 19 99 99 99 99 98 42 c3 66 66 66 66 66 68 6d 69 6e 20 20 20 20 20 -[2281] 41 40 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 36 00 00 00 00 00 00 -[2305] 42 ab 80 00 00 00 00 00 42 a7 99 99 99 99 99 98 4d 41 58 20 20 20 20 20 -[2329] 41 50 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[2353] 42 b5 66 66 66 66 66 68 42 98 e6 66 66 66 66 68 4d 41 58 20 20 20 20 20 -[2377] 41 60 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 -[2401] 42 a5 4c cc cc cc cc d0 42 a7 80 00 00 00 00 00 4d 41 58 20 20 20 20 20 -[2425] 41 70 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3f 00 00 00 00 00 00 -[2449] 42 a3 e6 66 66 66 66 68 42 9e 00 00 00 00 00 00 4d 41 58 20 20 20 20 20 -[2473] 41 80 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 46 00 00 00 00 00 00 -[2497] 42 98 80 00 00 00 00 00 42 96 33 33 33 33 33 30 4d 41 58 20 20 20 20 20 -[2521] 41 90 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3e 00 00 00 00 00 00 -[2545] 42 ad 80 00 00 00 00 00 42 be b3 33 33 33 33 30 6d 69 6e 20 20 20 20 20 -[2569] 00 00 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 -[2593] 42 93 e6 66 66 66 66 68 42 a4 e6 66 66 66 66 68 6d 69 6e 20 20 20 20 20 -[2617] 41 10 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 2a 00 00 00 00 00 00 -[2641] 42 b5 4c cc cc cc cc d0 42 97 80 00 00 00 00 00 6d 69 6e 20 20 20 20 20 -[2665] 41 20 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 23 00 00 00 00 00 00 -[2689] 42 7c 4c cc cc cc cc cc 42 86 66 66 66 66 66 68 6d 69 6e 20 20 20 20 20 -[2713] 41 30 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 2f 00 00 00 00 00 00 -[2737] 42 ae cc cc cc cc cc d0 42 c8 cc cc cc cc cc d0 6d 69 6e 20 20 20 20 20 -[2761] 41 40 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[2785] 42 a7 cc cc cc cc cc d0 42 b2 4c cc cc cc cc d0 4d 41 58 20 20 20 20 20 -[2809] 41 50 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 39 00 00 00 00 00 00 -[2833] 42 c1 66 66 66 66 66 68 42 b7 80 00 00 00 00 00 4d 41 58 20 20 20 20 20 -[2857] 41 60 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 -[2881] 42 96 b3 33 33 33 33 30 42 93 19 99 99 99 99 98 4d 41 58 20 20 20 20 20 -[2905] 41 70 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[2929] 42 8e 80 00 00 00 00 00 42 94 b3 33 33 33 33 30 4d 41 58 20 20 20 20 20 -[2953] 41 80 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[2977] 42 b0 66 66 66 66 66 68 42 cc cc cc cc cc cc d0 4d 41 58 20 20 20 20 20 -[3001] 41 90 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 46 00 00 00 00 00 00 -[3025] 42 90 33 33 33 33 33 30 42 8f cc cc cc cc cc d0 6d 69 6e 20 20 20 20 20 -[3049] 00 00 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3d 00 00 00 00 00 00 -[3073] 42 94 66 66 66 66 66 68 42 a8 cc cc cc cc cc d0 6d 69 6e 20 20 20 20 20 -[3097] 41 10 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 34 00 00 00 00 00 00 -[3121] 42 a4 e6 66 66 66 66 68 42 9e 99 99 99 99 99 98 6d 69 6e 20 20 20 20 20 -[3145] 41 20 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 2b 00 00 00 00 00 00 -[3169] 42 8d 33 33 33 33 33 30 42 9e 19 99 99 99 99 98 6d 69 6e 20 20 20 20 20 -[3193] 41 30 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 31 00 00 00 00 00 00 -[3217] 42 b0 80 00 00 00 00 00 42 d0 4c cc cc cc cc d0 6d 69 6e 20 20 20 20 20 -[3241] 41 40 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 -[3265] 42 b1 80 00 00 00 00 00 42 89 19 99 99 99 99 98 4d 41 58 20 20 20 20 20 -[3289] 41 50 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 -[3313] 42 ae 19 99 99 99 99 98 42 a0 33 33 33 33 33 30 4d 41 58 20 20 20 20 20 -[3337] 41 60 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 30 00 00 00 00 00 00 -[3361] 42 9b 80 00 00 00 00 00 42 b9 cc cc cc cc cc d0 4d 41 58 20 20 20 20 20 -[3385] 41 70 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3d 00 00 00 00 00 00 -[3409] 42 ba b3 33 33 33 33 30 42 9d b3 33 33 33 33 30 4d 41 58 20 20 20 20 20 -[3433] 41 80 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 40 00 00 00 00 00 00 -[3457] 42 a2 66 66 66 66 66 68 42 b3 66 66 66 66 66 68 4d 41 58 20 20 20 20 20 -[3481] 41 90 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 47 00 00 00 00 00 00 -[3505] 42 8d 00 00 00 00 00 00 42 a1 80 00 00 00 00 00 -> > ## Test that the files are identical > stopifnot( all(a.1 == a.2) ) > > proc.time() user system elapsed - 0.454 0.043 0.484 + 0.506 0.054 0.550 Modified: trunk/SASxport/tests/Theoph.Rout.save =================================================================== --- trunk/SASxport/tests/Theoph.Rout.save 2014-07-18 17:04:07 UTC (rev 1839) +++ trunk/SASxport/tests/Theoph.Rout.save 2014-07-18 17:11:52 UTC (rev 1840) @@ -57,4 +57,4 @@ > > proc.time() user system elapsed - 0.776 0.047 0.832 + 0.599 0.038 0.627 Modified: trunk/SASxport/tests/cars.R =================================================================== --- trunk/SASxport/tests/cars.R 2014-07-18 17:04:07 UTC (rev 1839) +++ trunk/SASxport/tests/cars.R 2014-07-18 17:11:52 UTC (rev 1840) @@ -10,21 +10,28 @@ summary(cars) +## Write to file write.xport(cars, file="cars2.xpt", cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), osType="SunOS", sasVer="9.1", autogen.formats=FALSE -) + ) +## Display for diff +write.xport(cars, + file="", + cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1", + autogen.formats=FALSE, + verbose=TRUE + ) ## Load both files back in as raw data a.1 <- readBin( con="cars.xpt", what=raw(), n=1e5) a.2 <- readBin( con="cars2.xpt", what=raw(), n=1e5) -## Display for diff -a.2 - ## Test that the files are identical stopifnot( all(a.1 == a.2) ) Modified: trunk/SASxport/tests/cars.Rout.save =================================================================== --- trunk/SASxport/tests/cars.Rout.save 2014-07-18 17:04:07 UTC (rev 1839) +++ trunk/SASxport/tests/cars.Rout.save 2014-07-18 17:11:52 UTC (rev 1840) @@ -60,129 +60,469 @@ Chev. :6 Max. :15906 Max. :35.00 Max. :5.000 Max. :1.0000 Datsun:4 > +> ## Write to file > write.xport(cars, + file="cars2.xpt", + cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1", + autogen.formats=FALSE -+ ) ++ ) > +> ## Display for diff +> write.xport(cars, ++ file="", ++ cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), ++ osType="SunOS", ++ sasVer="9.1", ++ autogen.formats=FALSE, ++ verbose=TRUE ++ ) +### Ensure all objects to be stored are data.frames... + ### +### Ensure object names are valid and unique... + ### +### opening file ... ### +### Done ### +### Write file header ... ### +ASCII: HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000 SAS SAS SASLIB 9.1 SunOS... 28JUL07:20:59:4928JUL07:20:59:49 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 53 41 53 4c 49 42 20 20 39 2e 31 20 20 20 20 20 53 75 6e 4f 53 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +### Done. ### +### Write data frame header ... ### +ASCII: HEADER RECORD*******MEMBER HEADER RECORD!!!!!!!000000000000000001600000000140 HEADER RECORD*******DSCRPTR HEADER RECORD!!!!!!!000000000000000000000000000000 SAS CARS SASDATA 9.1 SunOS... 28JUL07:20:59:4928JUL07:20:59:49 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 43 41 52 53 20 20 20 20 53 41 53 44 41 54 41 20 39 2e 31 20 20 20 20 20 53 75 6e 4f 53 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +### Done. ### +### Write variable information block header ... ### +ASCII: HEADER RECORD*******NAMESTR HEADER RECORD!!!!!!!000000000500000000000000000000 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 35 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 +### Done. ### +### Write entries for variable information block ... ### +### MAKE ... ### +ASCII: ........MAKE ........ ............................................................ +HEX: 00 02 00 00 00 08 00 01 4d 41 4b 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### PRICE ... ### +ASCII: ........PRICE ........ ............................................................ +HEX: 00 01 00 00 00 08 00 02 50 52 49 43 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### MPG ... ### +ASCII: ........MPG ........ ............................................................ +HEX: 00 01 00 00 00 08 00 03 4d 50 47 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### REP78 ... ### +ASCII: ........REP78 ........ ............................................................ +HEX: 00 01 00 00 00 08 00 04 52 45 50 37 38 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### FOREIGN ... ### +ASCII: ........FOREIGN ........ ....... .................................................... +HEX: 00 01 00 00 00 08 00 05 46 4f 52 45 49 47 4e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +### Done. ### +ASCII: +HEX: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +### Write header for data block ... ### +ASCII: HEADER RECORD*******OBS HEADER RECORD!!!!!!!000000000000000000000000000000 +HEX: 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4f 42 53 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 +### Done ### +### Write data ... ### +### i= 1 j= 1 value= AMC len= 8 ### +ASCII: AMC +HEX: 41 4d 43 20 20 20 20 20 +### i= 1 j= 2 value= 4099 len= 8 ### +ASCII: D....... +HEX: 44 10 03 00 00 00 00 00 +### i= 1 j= 3 value= 22 len= 8 ### +ASCII: B....... +HEX: 42 16 00 00 00 00 00 00 +### i= 1 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 1 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 2 j= 1 value= AMC len= 8 ### +ASCII: AMC +HEX: 41 4d 43 20 20 20 20 20 +### i= 2 j= 2 value= 4749 len= 8 ### +ASCII: D....... +HEX: 44 12 8d 00 00 00 00 00 +### i= 2 j= 3 value= 17 len= 8 ### +ASCII: B....... +HEX: 42 11 00 00 00 00 00 00 +### i= 2 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 2 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 3 j= 1 value= AMC len= 8 ### +ASCII: AMC +HEX: 41 4d 43 20 20 20 20 20 +### i= 3 j= 2 value= 3799 len= 8 ### +ASCII: C.p..... +HEX: 43 ed 70 00 00 00 00 00 +### i= 3 j= 3 value= 22 len= 8 ### +ASCII: B....... +HEX: 42 16 00 00 00 00 00 00 +### i= 3 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 3 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 4 j= 1 value= Audi len= 8 ### +ASCII: Audi +HEX: 41 75 64 69 20 20 20 20 +### i= 4 j= 2 value= 9690 len= 8 ### +ASCII: D%...... +HEX: 44 25 da 00 00 00 00 00 +### i= 4 j= 3 value= 17 len= 8 ### +ASCII: B....... +HEX: 42 11 00 00 00 00 00 00 +### i= 4 j= 4 value= 5 len= 8 ### +ASCII: AP...... +HEX: 41 50 00 00 00 00 00 00 +### i= 4 j= 5 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 5 j= 1 value= Audi len= 8 ### +ASCII: Audi +HEX: 41 75 64 69 20 20 20 20 +### i= 5 j= 2 value= 6295 len= 8 ### +ASCII: D....... +HEX: 44 18 97 00 00 00 00 00 +### i= 5 j= 3 value= 23 len= 8 ### +ASCII: B....... +HEX: 42 17 00 00 00 00 00 00 +### i= 5 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 5 j= 5 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 6 j= 1 value= BMW len= 8 ### +ASCII: BMW +HEX: 42 4d 57 20 20 20 20 20 +### i= 6 j= 2 value= 9735 len= 8 ### +ASCII: D&...... +HEX: 44 26 07 00 00 00 00 00 +### i= 6 j= 3 value= 25 len= 8 ### +ASCII: B....... +HEX: 42 19 00 00 00 00 00 00 +### i= 6 j= 4 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 6 j= 5 value= 1 len= 8 ### +ASCII: A....... +HEX: 41 10 00 00 00 00 00 00 +### i= 7 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 7 j= 2 value= 4816 len= 8 ### +ASCII: D....... +HEX: 44 12 d0 00 00 00 00 00 +### i= 7 j= 3 value= 20 len= 8 ### +ASCII: B....... +HEX: 42 14 00 00 00 00 00 00 +### i= 7 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 7 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 8 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 8 j= 2 value= 7827 len= 8 ### +ASCII: D....... +HEX: 44 1e 93 00 00 00 00 00 +### i= 8 j= 3 value= 15 len= 8 ### +ASCII: A....... +HEX: 41 f0 00 00 00 00 00 00 +### i= 8 j= 4 value= 4 len= 8 ### +ASCII: A@...... +HEX: 41 40 00 00 00 00 00 00 +### i= 8 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 9 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 9 j= 2 value= 5788 len= 8 ### +ASCII: D....... +HEX: 44 16 9c 00 00 00 00 00 +### i= 9 j= 3 value= 18 len= 8 ### +ASCII: B....... +HEX: 42 12 00 00 00 00 00 00 +### i= 9 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 9 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 10 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 10 j= 2 value= 4453 len= 8 ### +ASCII: D.e..... +HEX: 44 11 65 00 00 00 00 00 +### i= 10 j= 3 value= 26 len= 8 ### +ASCII: B....... +HEX: 42 1a 00 00 00 00 00 00 +### i= 10 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 10 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 11 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 11 j= 2 value= 5189 len= 8 ### +ASCII: D.E..... +HEX: 44 14 45 00 00 00 00 00 +### i= 11 j= 3 value= 20 len= 8 ### +ASCII: B....... +HEX: 42 14 00 00 00 00 00 00 +### i= 11 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 11 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 12 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 12 j= 2 value= 10372 len= 8 ### +ASCII: D(...... +HEX: 44 28 84 00 00 00 00 00 +### i= 12 j= 3 value= 16 len= 8 ### +ASCII: B....... +HEX: 42 10 00 00 00 00 00 00 +### i= 12 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 12 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 13 j= 1 value= Buick len= 8 ### +ASCII: Buick +HEX: 42 75 69 63 6b 20 20 20 +### i= 13 j= 2 value= 4082 len= 8 ### +ASCII: C. ..... +HEX: 43 ff 20 00 00 00 00 00 +### i= 13 j= 3 value= 19 len= 8 ### +ASCII: B....... +HEX: 42 13 00 00 00 00 00 00 +### i= 13 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 13 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 14 j= 1 value= Cad. len= 8 ### +ASCII: Cad. +HEX: 43 61 64 2e 20 20 20 20 +### i= 14 j= 2 value= 11385 len= 8 ### +ASCII: D,y..... +HEX: 44 2c 79 00 00 00 00 00 +### i= 14 j= 3 value= 14 len= 8 ### +ASCII: A....... +HEX: 41 e0 00 00 00 00 00 00 +### i= 14 j= 4 value= 3 len= 8 ### +ASCII: A0...... +HEX: 41 30 00 00 00 00 00 00 +### i= 14 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00 +### i= 15 j= 1 value= Cad. len= 8 ### +ASCII: Cad. +HEX: 43 61 64 2e 20 20 20 20 +### i= 15 j= 2 value= 14500 len= 8 ### +ASCII: D8...... +HEX: 44 38 a4 00 00 00 00 00 +### i= 15 j= 3 value= 14 len= 8 ### +ASCII: A....... +HEX: 41 e0 00 00 00 00 00 00 +### i= 15 j= 4 value= 2 len= 8 ### +ASCII: A ...... +HEX: 41 20 00 00 00 00 00 00 +### i= 15 j= 5 value= 0 len= 8 ### +ASCII: ........ +HEX: 00 00 00 00 00 00 00 00... [truncated message content] |
From: <wa...@us...> - 2014-07-18 17:04:10
|
Revision: 1839 http://sourceforge.net/p/r-gregmisc/code/1839 Author: warnes Date: 2014-07-18 17:04:07 +0000 (Fri, 18 Jul 2014) Log Message: ----------- minor code formatting changes Modified Paths: -------------- trunk/SASxport/src/SASxport.c trunk/SASxport/src/ibm2ieee.c trunk/SASxport/src/writeSAS.c Modified: trunk/SASxport/src/SASxport.c =================================================================== --- trunk/SASxport/src/SASxport.c 2014-07-18 17:03:46 UTC (rev 1838) +++ trunk/SASxport/src/SASxport.c 2014-07-18 17:04:07 UTC (rev 1839) @@ -62,7 +62,7 @@ static double get_IBM_double(char* c, size_t len) { - /* Conversion from IBM 360 format to double */ +/* Conversion from IBM 360 format to double */ /* * IBM format: * 6 5 0 @@ -77,14 +77,14 @@ * the high order hex fraction digit. */ unsigned int i, upper, lower; - /* exponent is expressed here as - excess 70 (=64+6) to accomodate - integer conversion of c[1] to c[4] */ + /* exponent is expressed here as + excess 70 (=64+6) to accomodate + integer conversion of c[1] to c[4] */ char negative = c[0] & 0x80, exponent = (c[0] & 0x7f) - 70, buf[4]; - double value; + double value; char ibuf[8]; - if (len < 2 || len > 8) + if (len < 2 || len > 8) error(_("invalid field length in numeric variable")); /* this effectively zero-pads c: */ @@ -169,7 +169,7 @@ return 0; return 1; } - + static int get_mem_header(FILE *fp, struct SAS_XPORT_member *member) { @@ -179,7 +179,7 @@ n = GET_RECORD(record, fp, 80); if(n != 80 || strncmp(DSC_HEADER, record, 80) != 0) error(_("file not in SAS transfer format")); - + n = GET_RECORD(record, fp, 80); if(n != 80) return 0; @@ -224,7 +224,7 @@ Free(lib_head); n = GET_RECORD(record, fp, 80); - if(n != 80 || + if(n != 80 || strncmp(MEM_HEADER, record, 75) != 0 || strncmp(" ", record+78, 2) != 0 ) error(_("file not in SAS transfer format")); @@ -290,20 +290,20 @@ } static int -next_xport_info(FILE *fp, int namestr_length, int nvars, +next_xport_info(FILE *fp, int namestr_length, int nvars, int *headpad, - int *tailpad, - int *length, - int *ntype, + int *tailpad, + int *length, + int *ntype, int *nlng, - int *nvar0, - SEXP nname, - SEXP nlabel, - SEXP nform, - int *nfl, - int *nfd, - SEXP niform, - int *nifl, + int *nvar0, + SEXP nname, + SEXP nlabel, + SEXP nform, + int *nfl, + int *nfd, + SEXP niform, + int *nifl, int *nifd, int *npos) { @@ -331,13 +331,13 @@ } (*headpad) += i; } - + n = GET_RECORD(record, fp, 80); if(n != 80 || strncmp(OBS_HEADER, record, 80) != 0) { Free(nam_head); error(_("file not in SAS transfer format")); } - + for(i = 0; i < nvars; i++) { int nname_len = 0, nlabel_len = 0, nform_len = 0, niform_len=0; char tmpname[41]; @@ -455,7 +455,7 @@ sscanf(record+75, "%d", &namestr_length); break; } - + if (fsetpos(fp, ¤tPos)) { error(_("problem accessing SAS XPORT file")); } @@ -663,14 +663,14 @@ SET_STRING_ELT(ansNames , ansLength, mkChar(dsname )); SET_VECTOR_ELT(ans, ansLength, varInfo); ansLength++; - + UNPROTECT(7); PROTECT(ans); PROTECT(ansNames); } - setAttrib(ans, R_NamesSymbol, ansNames); + setAttrib(ans, R_NamesSymbol, ansNames); UNPROTECT(5); fclose(fp); return ans; @@ -736,7 +736,7 @@ for(k = nvar-1; k >= 0; k--) { tmpchar = record + dataPosition[k]; if(dataType[k] == REALSXP) { - REAL(VECTOR_ELT(data, k))[j] = + REAL(VECTOR_ELT(data, k))[j] = get_IBM_double(tmpchar, dataWidth[k]); } else { tmpchar[dataWidth[k]] = '\0'; @@ -753,7 +753,7 @@ } fseek(fp, dataTailPad, SEEK_CUR); - + Free(record); } UNPROTECT(1); Modified: trunk/SASxport/src/ibm2ieee.c =================================================================== --- trunk/SASxport/src/ibm2ieee.c 2014-07-18 17:03:46 UTC (rev 1838) +++ trunk/SASxport/src/ibm2ieee.c 2014-07-18 17:04:07 UTC (rev 1839) @@ -30,7 +30,7 @@ * * Convert an array of IBM/360 format double precision values of at *in * of length 'count' to BIG-ENDIAN IEEE double precision value at *out. - * + * * This code was extracted from the "ntohd" function, original author * Michael John Muuss * @@ -63,7 +63,9 @@ continue; } \ -void ibm2ieee(register unsigned char *out, register const unsigned char *in, int count) +void ibm2ieee(register unsigned char *out, + register const unsigned char *in, + int count) { /* * IBM Format. @@ -75,11 +77,11 @@ register unsigned int left, right, signbit; register int exp; - left = ( (unsigned int) in[0]<<24) | - ( (unsigned int) in[1]<<16) | - ( (unsigned int) in[2]<<8) | + left = ( (unsigned int) in[0]<<24) | + ( (unsigned int) in[1]<<16) | + ( (unsigned int) in[2]<<8) | in[3]; - right = ( (unsigned int) in[4]<<24) | + right = ( (unsigned int) in[4]<<24) | ( (unsigned int) in[5]<<16) | ( (unsigned int) in[6]<<8) | in[7]; Modified: trunk/SASxport/src/writeSAS.c =================================================================== --- trunk/SASxport/src/writeSAS.c 2014-07-18 17:03:46 UTC (rev 1838) +++ trunk/SASxport/src/writeSAS.c 2014-07-18 17:04:07 UTC (rev 1839) @@ -5,7 +5,7 @@ * Author: Gregory R. Warnes <gr...@wa...> * * Copyright (C) 2007-2013 Gregory R. Warnes <gr...@wa...> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -40,7 +40,7 @@ { int i; - for(i=0; i<(len); i++) + for(i=0; i<(len); i++) target[i]=' '; } @@ -64,7 +64,7 @@ { int i; - for(i=0; i<(len); i++) + for(i=0; i<(len); i++) target[i]=0; } @@ -90,7 +90,7 @@ * This function is used to retreive the filled buffer as an R 'raw' * object. This is necessary because the buffer legitimately contains * embedded nulls and R currently does not permit raw buffers to be - * passed via .C . + * passed via .C . */ #define MYBUFSIZE 1024 /* plenty big */ @@ -113,7 +113,7 @@ -void fill_file_header( +void fill_file_header( char **cDate, /* creation date */ char **mdate, /* modification date */ char **sasVer, /* SAS version number */ @@ -127,7 +127,7 @@ /* Line 2*/ blankCopy( file_header.sas_symbol1, 8, "SAS "); - blankCopy( file_header.sas_symbol2, 8, "SAS "); + blankCopy( file_header.sas_symbol2, 8, "SAS "); blankCopy( file_header.saslib, 8, "SASLIB "); blankCopy( file_header.sasver, 8, sasVer[0] ); zeroCopy ( file_header.sas_os, 8, osType[0] ); @@ -148,7 +148,7 @@ } -void fill_member_header( +void fill_member_header( char **dfName, /* Name of data set */ char **sasVer, /* SAS version number */ char **osType, /* Operating System */ @@ -220,19 +220,19 @@ int *nvar0, /* VARNUM */ char **nname, /* NAME OF VARIABLE */ char **nlabel, /* LABEL OF VARIABLE */ - + char **nform, /* NAME OF FORMAT */ int *nfl, /* FORMAT FIELD LENGTH OR 0 */ int *nfd, /* FORMAT NUMBER OF DECIMALS */ int *nfj, /* 0=LEFT JUSTIFICATION, 1=RIGHT JUST */ - + // char nfill[2], /* (UNUSED, FOR ALIGNMENT AND FUTURE) */ - + char **niform, /* NAME OF INPUT FORMAT */ int *nifl, /* INFORMAT LENGTH ATTRIBUTE */ int *nifd, /* INFORMAT NUMBER OF DECIMALS */ int *npos /* POSITION OF VALUE IN OBSERVATION */ - + // char rest[52], /* remaining fields are irrelevant */ ) { @@ -250,19 +250,19 @@ namestr_record.nfd = (short) *nfd; /* FORMAT NUMBER OF DECIMALS */ namestr_record.nfj = (short) *nfj; /* 0=LEFT JUSTIFICATION, 1=RIGHT JUST */ - zeroFill(namestr_record.nfill, 2); /* (UNUSED, FOR ALIGNMENT AND FUTURE) */ + zeroFill(namestr_record.nfill, 2); /* (UNUSED, FOR ALIGNMENT AND FUTURE) */ blankCopy(namestr_record.niform, 8, niform[0]); /* NAME OF INPUT FORMAT */ namestr_record.nifl = (short) *nifl; /* INFORMAT LENGTH ATTRIBUTE */ namestr_record.nifd = (short) *nifd; /* INFORMAT NUMBER OF DECIMALS */ - namestr_record.npos = (int) *npos; /* POSITION OF VALUE IN OBSERVATION */ + namestr_record.npos = (int) *npos; /* POSITION OF VALUE IN OBSERVATION */ zeroFill(namestr_record.rest, 52); /* remaining fields are irrelevant */ /* Flip byte order if necessary */ #define SHORTREV(a) REVERSE( &a, sizeof(short) ) -#define INTREV(a) REVERSE( &a, sizeof(int) ) +#define INTREV(a) REVERSE( &a, sizeof(int) ) SHORTREV( namestr_record.ntype ); SHORTREV( namestr_record.nhfun ); @@ -274,7 +274,7 @@ SHORTREV( namestr_record.nifl ); SHORTREV( namestr_record.nifd ); - INTREV ( namestr_record.npos ); + INTREV ( namestr_record.npos ); /* copy filled struct to return area */ memcpy( raw_buffer, &namestr_record, sizeof(namestr_record) ); @@ -284,13 +284,13 @@ return; } - - + + void fill_obs_header() { struct OBS_HEADER obs_header; - blankCopy( obs_header.l1, 80, + blankCopy( obs_header.l1, 80, "HEADER RECORD*******OBS HEADER RECORD!!!!!!!000000000000000000000000000000 "); /* copy filled struct to return area */ @@ -305,10 +305,10 @@ void fill_numeric_field( double *value /* single numeric value */ - ) + ) { /* convert to IBM floating point */ - + reverse( (unsigned char*) value, sizeof(double) ); ieee2ibm( (unsigned char *) raw_buffer, (unsigned char *) value, 1); @@ -320,11 +320,11 @@ return; } - + void fill_character_field( char **value, /* single character string */ int *width /* field width */ - ) + ) { /* copy to buffer */ blankCopy(raw_buffer, *width, value[0]); @@ -344,7 +344,7 @@ return; } - + void fill_space( int *type, /* 0 --> zero fill, 1 --> space fill */ int *width This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 17:03:50
|
Revision: 1838 http://sourceforge.net/p/r-gregmisc/code/1838 Author: warnes Date: 2014-07-18 17:03:46 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Re-ename optimization on BIG_ENDIAN systems Modified Paths: -------------- trunk/SASxport/src/writeSAS.h Modified: trunk/SASxport/src/writeSAS.h =================================================================== --- trunk/SASxport/src/writeSAS.h 2014-07-18 15:29:30 UTC (rev 1837) +++ trunk/SASxport/src/writeSAS.h 2014-07-18 17:03:46 UTC (rev 1838) @@ -5,7 +5,7 @@ * Author: Gregory R. Warnes <gr...@wa...> * * Copyright (C) 2007 Gregory R. Warnes <gr...@wa...> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -33,23 +33,21 @@ /***** - * Useful constants + * Useful constants *****/ #define MISSING 0x2e000000 /* Standard SAS missing value: '.' */ /***** REVERSE macro, used as a wrapper for the reverse() function to avoid - compiling/calling it on little-endian. + compiling/calling it on big-endian, where it is a NOOP. *****/ -/* #ifdef BIG_ENDIAN */ -/* # define REVERSE(a,b) */ -/* #elif defined(LITTLE_ENDIAN) */ -/* # define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b) */ -/* #else */ -# define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b) -/*#endif*/ +#if ( defined(BIG_ENDIAN) && BIG_ENDIAN ) || ( defined(LITTLE_ENDIAN) && !LITTLE_ENDIAN ) +# define REVERSE(a,b) ( a ) +#else +# define REVERSE(a,b) reverse( (unsigned char*) a, (size_t) b ) +#endif /***** * Useful macro functions @@ -64,7 +62,7 @@ /***** - * File Record Structures + * File Record Structures *****/ struct FILE_HEADER { @@ -73,7 +71,7 @@ /* Line 2 */ char sas_symbol1[8]; - char sas_symbol2[8]; + char sas_symbol2[8]; char saslib[8]; char sasver[8]; char sas_os[8]; @@ -98,12 +96,12 @@ char sasdata[8]; char sasver[8]; char sas_osname[8]; - char blanks[24]; + char blanks[24]; char sas_create[16]; /* Line 4 */ char sas_modified[16]; - //char blanks2[64]; + //char blanks2[64]; char padding[16]; char dslabel[40]; char dstype[8]; @@ -124,7 +122,7 @@ short nvar0; /* VARNUM */ char nname[8]; /* NAME OF VARIABLE */ char nlabel[40]; /* LABEL OF VARIABLE */ - + char nform[8]; /* NAME OF FORMAT */ short nfl; /* FORMAT FIELD LENGTH OR 0 */ short nfd; /* FORMAT NUMBER OF DECIMALS */ @@ -137,7 +135,7 @@ short nifd; /* INFORMAT NUMBER OF DECIMALS */ int npos; /* POSITION OF VALUE IN OBSERVATION */ - + char rest[52]; /* remaining fields are irrelevant */ }; @@ -157,18 +155,18 @@ void zeroCopy(char *target, int len, char *source); void fill_file_header(char **cDate, char **mDate, char **sasVer, char **osType); -void fill_member_header(char **dfName, char **sasVer, char **osType, char **cDate, +void fill_member_header(char **dfName, char **sasVer, char **osType, char **cDate, char **mDate, char **dfLabel, char **dfType); -void fill_namestr(int *isChar, int *nlng, int *nvar0, char **nname, char **nlabel, - char **nform, int *nfl, int *nfd, int *nfj, char **niform, +void fill_namestr(int *isChar, int *nlng, int *nvar0, char **nname, char **nlabel, + char **nform, int *nfl, int *nfd, int *nfj, char **niform, int *nifl, int *nifd, int *npos); void fill_namestr_header(char **nvar); void fill_obs_header(); void fill_numeric_field(double *value); -void fill_character_field(char **value, int *width); +void fill_character_field(char **value, int *width); void fill_numeric_NA(); void fill_space(int *type, int *width); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 15:29:39
|
Revision: 1837 http://sourceforge.net/p/r-gregmisc/code/1837 Author: warnes Date: 2014-07-18 15:29:30 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Update .save files Modified Paths: -------------- trunk/SASxport/tests/Alfalfa_Test.Rout.save trunk/SASxport/tests/Theoph.Rout.save trunk/SASxport/tests/cars.Rout.save trunk/SASxport/tests/testDates.Rout.save trunk/SASxport/tests/testDuplicateNames.Rout.save trunk/SASxport/tests/testEmpty.Rout.save trunk/SASxport/tests/testExamples.Rout.save trunk/SASxport/tests/testManyNames.Rout.save trunk/SASxport/tests/testNegative.Rout.save trunk/SASxport/tests/testNumeric.Rout.save trunk/SASxport/tests/testUnnamedComponents.Rout.save trunk/SASxport/tests/test_as_is.Rout.save trunk/SASxport/tests/test_fields.Rout.save trunk/SASxport/tests/xport.Rout.save trunk/SASxport/tests/xxx.Rout.save Modified: trunk/SASxport/tests/Alfalfa_Test.Rout.save =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -56,9 +56,159 @@ > a.1 <- readBin( con="Alfalfa.xpt", what=raw(), n=3600 ) > a.2 <- readBin( con="Alfalfa2.xpt", what=raw(), n=3600 ) > +> ## Display for diff +> a.2 + [1] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 + [25] 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [49] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [73] 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 + [97] 53 41 53 4c 49 42 20 20 37 2e 30 30 20 20 20 20 4f 53 46 31 00 00 00 00 + [121] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [145] 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 31 30 44 45 43 39 39 3a + [169] 31 35 3a 35 36 3a 33 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [193] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [217] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [241] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 + [265] 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [289] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 + [313] 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [337] 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [361] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [385] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 + [409] 53 50 45 43 20 20 20 20 53 41 53 44 41 54 41 20 37 2e 30 30 20 20 20 20 + [433] 4f 53 46 31 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [457] 20 20 20 20 20 20 20 20 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 + [481] 31 30 44 45 43 39 39 3a 31 35 3a 35 36 3a 33 30 20 20 20 20 20 20 20 20 + [505] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [529] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [553] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [577] 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [601] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 36 30 30 30 30 30 30 + [625] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 00 02 00 00 00 08 00 01 + [649] 50 4f 50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [673] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [697] 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 + [721] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [745] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [769] 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 08 00 02 53 41 4d 50 + [793] 4c 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [817] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [841] 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 + [865] 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [889] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [913] 00 00 00 00 00 00 00 00 00 01 00 00 00 08 00 03 52 45 50 20 20 20 20 20 + [937] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [961] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [985] 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 10 +[1009] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1033] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1057] 00 00 00 00 00 01 00 00 00 08 00 04 53 45 45 44 57 54 20 20 20 20 20 20 +[1081] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1105] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 +[1129] 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 18 00 00 00 00 +[1153] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1177] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1201] 00 01 00 00 00 08 00 05 48 41 52 56 31 20 20 20 20 20 20 20 20 20 20 20 +[1225] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1249] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 +[1273] 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 +[1297] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1321] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 +[1345] 00 08 00 06 48 41 52 56 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1369] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1393] 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 +[1417] 20 20 20 20 00 00 00 00 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 00 +[1441] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1465] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 +[1489] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1513] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a +[1537] 2a 2a 2a 2a 4f 42 53 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 +[1561] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 +[1585] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 6d 69 6e 20 20 20 20 20 +[1609] 00 00 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 40 00 00 00 00 00 00 +[1633] 42 ab b3 33 33 33 33 30 42 b4 4c cc cc cc cc d0 6d 69 6e 20 20 20 20 20 +[1657] 41 10 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 36 00 00 00 00 00 00 +[1681] 42 8a 33 33 33 33 33 30 42 96 b3 33 33 33 33 30 6d 69 6e 20 20 20 20 20 +[1705] 41 20 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 28 00 00 00 00 00 00 +[1729] 42 91 99 99 99 99 99 98 42 81 19 99 99 99 99 98 6d 69 6e 20 20 20 20 20 +[1753] 41 30 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 2d 00 00 00 00 00 00 +[1777] 42 aa 66 66 66 66 66 68 42 bf 33 33 33 33 33 30 6d 69 6e 20 20 20 20 20 +[1801] 41 40 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 40 00 00 00 00 00 00 +[1825] 42 7c cc cc cc cc cc cc 42 ac 99 99 99 99 99 98 4d 41 58 20 20 20 20 20 +[1849] 41 50 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 4b 00 00 00 00 00 00 +[1873] 42 b3 00 00 00 00 00 00 42 eb 4c cc cc cc cc d0 4d 41 58 20 20 20 20 20 +[1897] 41 60 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 2d 00 00 00 00 00 00 +[1921] 42 a6 4c cc cc cc cc d0 42 ad e6 66 66 66 66 68 4d 41 58 20 20 20 20 20 +[1945] 41 70 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 3f 00 00 00 00 00 00 +[1969] 42 a9 b3 33 33 33 33 30 42 9b cc cc cc cc cc d0 4d 41 58 20 20 20 20 20 +[1993] 41 80 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 41 00 00 00 00 00 00 +[2017] 42 c0 e6 66 66 66 66 68 42 b1 99 99 99 99 99 98 4d 41 58 20 20 20 20 20 +[2041] 41 90 00 00 00 00 00 00 41 10 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[2065] 42 b9 cc cc cc cc cc d0 42 b3 33 33 33 33 33 30 6d 69 6e 20 20 20 20 20 +[2089] 00 00 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[2113] 42 9e cc cc cc cc cc d0 42 8b b3 33 33 33 33 30 6d 69 6e 20 20 20 20 20 +[2137] 41 10 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 2e 00 00 00 00 00 00 +[2161] 42 a3 b3 33 33 33 33 30 42 96 00 00 00 00 00 00 6d 69 6e 20 20 20 20 20 +[2185] 41 20 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 2a 00 00 00 00 00 00 +[2209] 42 78 99 99 99 99 99 98 42 83 19 99 99 99 99 98 6d 69 6e 20 20 20 20 20 +[2233] 41 30 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 26 00 00 00 00 00 00 +[2257] 42 c1 19 99 99 99 99 98 42 c3 66 66 66 66 66 68 6d 69 6e 20 20 20 20 20 +[2281] 41 40 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 36 00 00 00 00 00 00 +[2305] 42 ab 80 00 00 00 00 00 42 a7 99 99 99 99 99 98 4d 41 58 20 20 20 20 20 +[2329] 41 50 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[2353] 42 b5 66 66 66 66 66 68 42 98 e6 66 66 66 66 68 4d 41 58 20 20 20 20 20 +[2377] 41 60 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 +[2401] 42 a5 4c cc cc cc cc d0 42 a7 80 00 00 00 00 00 4d 41 58 20 20 20 20 20 +[2425] 41 70 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3f 00 00 00 00 00 00 +[2449] 42 a3 e6 66 66 66 66 68 42 9e 00 00 00 00 00 00 4d 41 58 20 20 20 20 20 +[2473] 41 80 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 46 00 00 00 00 00 00 +[2497] 42 98 80 00 00 00 00 00 42 96 33 33 33 33 33 30 4d 41 58 20 20 20 20 20 +[2521] 41 90 00 00 00 00 00 00 41 20 00 00 00 00 00 00 42 3e 00 00 00 00 00 00 +[2545] 42 ad 80 00 00 00 00 00 42 be b3 33 33 33 33 30 6d 69 6e 20 20 20 20 20 +[2569] 00 00 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 +[2593] 42 93 e6 66 66 66 66 68 42 a4 e6 66 66 66 66 68 6d 69 6e 20 20 20 20 20 +[2617] 41 10 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 2a 00 00 00 00 00 00 +[2641] 42 b5 4c cc cc cc cc d0 42 97 80 00 00 00 00 00 6d 69 6e 20 20 20 20 20 +[2665] 41 20 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 23 00 00 00 00 00 00 +[2689] 42 7c 4c cc cc cc cc cc 42 86 66 66 66 66 66 68 6d 69 6e 20 20 20 20 20 +[2713] 41 30 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 2f 00 00 00 00 00 00 +[2737] 42 ae cc cc cc cc cc d0 42 c8 cc cc cc cc cc d0 6d 69 6e 20 20 20 20 20 +[2761] 41 40 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[2785] 42 a7 cc cc cc cc cc d0 42 b2 4c cc cc cc cc d0 4d 41 58 20 20 20 20 20 +[2809] 41 50 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 39 00 00 00 00 00 00 +[2833] 42 c1 66 66 66 66 66 68 42 b7 80 00 00 00 00 00 4d 41 58 20 20 20 20 20 +[2857] 41 60 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 +[2881] 42 96 b3 33 33 33 33 30 42 93 19 99 99 99 99 98 4d 41 58 20 20 20 20 20 +[2905] 41 70 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[2929] 42 8e 80 00 00 00 00 00 42 94 b3 33 33 33 33 30 4d 41 58 20 20 20 20 20 +[2953] 41 80 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[2977] 42 b0 66 66 66 66 66 68 42 cc cc cc cc cc cc d0 4d 41 58 20 20 20 20 20 +[3001] 41 90 00 00 00 00 00 00 41 30 00 00 00 00 00 00 42 46 00 00 00 00 00 00 +[3025] 42 90 33 33 33 33 33 30 42 8f cc cc cc cc cc d0 6d 69 6e 20 20 20 20 20 +[3049] 00 00 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3d 00 00 00 00 00 00 +[3073] 42 94 66 66 66 66 66 68 42 a8 cc cc cc cc cc d0 6d 69 6e 20 20 20 20 20 +[3097] 41 10 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 34 00 00 00 00 00 00 +[3121] 42 a4 e6 66 66 66 66 68 42 9e 99 99 99 99 99 98 6d 69 6e 20 20 20 20 20 +[3145] 41 20 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 2b 00 00 00 00 00 00 +[3169] 42 8d 33 33 33 33 33 30 42 9e 19 99 99 99 99 98 6d 69 6e 20 20 20 20 20 +[3193] 41 30 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 31 00 00 00 00 00 00 +[3217] 42 b0 80 00 00 00 00 00 42 d0 4c cc cc cc cc d0 6d 69 6e 20 20 20 20 20 +[3241] 41 40 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3c 00 00 00 00 00 00 +[3265] 42 b1 80 00 00 00 00 00 42 89 19 99 99 99 99 98 4d 41 58 20 20 20 20 20 +[3289] 41 50 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3b 00 00 00 00 00 00 +[3313] 42 ae 19 99 99 99 99 98 42 a0 33 33 33 33 33 30 4d 41 58 20 20 20 20 20 +[3337] 41 60 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 30 00 00 00 00 00 00 +[3361] 42 9b 80 00 00 00 00 00 42 b9 cc cc cc cc cc d0 4d 41 58 20 20 20 20 20 +[3385] 41 70 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 3d 00 00 00 00 00 00 +[3409] 42 ba b3 33 33 33 33 30 42 9d b3 33 33 33 33 30 4d 41 58 20 20 20 20 20 +[3433] 41 80 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 40 00 00 00 00 00 00 +[3457] 42 a2 66 66 66 66 66 68 42 b3 66 66 66 66 66 68 4d 41 58 20 20 20 20 20 +[3481] 41 90 00 00 00 00 00 00 41 40 00 00 00 00 00 00 42 47 00 00 00 00 00 00 +[3505] 42 8d 00 00 00 00 00 00 42 a1 80 00 00 00 00 00 +> > ## Test that the files are identical > stopifnot( all(a.1 == a.2) ) > > proc.time() user system elapsed - 0.487 0.038 0.517 + 0.454 0.043 0.484 Modified: trunk/SASxport/tests/Theoph.Rout.save =================================================================== --- trunk/SASxport/tests/Theoph.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/Theoph.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -57,4 +57,4 @@ > > proc.time() user system elapsed - 0.692 0.045 0.747 + 0.776 0.047 0.832 Modified: trunk/SASxport/tests/cars.Rout.save =================================================================== --- trunk/SASxport/tests/cars.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/cars.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -65,7 +65,7 @@ + cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1", -+ autogen.formats=FALSE ++ autogen.formats=FALSE + ) > > @@ -73,9 +73,116 @@ > a.1 <- readBin( con="cars.xpt", what=raw(), n=1e5) > a.2 <- readBin( con="cars2.xpt", what=raw(), n=1e5) > +> ## Display for diff +> a.2 + [1] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 + [25] 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [49] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [73] 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 + [97] 53 41 53 4c 49 42 20 20 39 2e 31 20 20 20 20 20 53 75 6e 4f 53 00 00 00 + [121] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [145] 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 32 38 4a 55 4c 30 37 3a + [169] 32 30 3a 35 39 3a 34 39 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [193] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [217] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [241] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 + [265] 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [289] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 + [313] 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [337] 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [361] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [385] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 + [409] 43 41 52 53 20 20 20 20 53 41 53 44 41 54 41 20 39 2e 31 20 20 20 20 20 + [433] 53 75 6e 4f 53 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [457] 20 20 20 20 20 20 20 20 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 + [481] 32 38 4a 55 4c 30 37 3a 32 30 3a 35 39 3a 34 39 20 20 20 20 20 20 20 20 + [505] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [529] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [553] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [577] 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [601] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 35 30 30 30 30 30 30 + [625] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 00 02 00 00 00 08 00 01 + [649] 4d 41 4b 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [673] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [697] 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 + [721] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [745] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [769] 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 08 00 02 50 52 49 43 + [793] 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [817] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [841] 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 + [865] 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [889] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [913] 00 00 00 00 00 00 00 00 00 01 00 00 00 08 00 03 4d 50 47 20 20 20 20 20 + [937] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [961] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [985] 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 10 +[1009] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1033] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1057] 00 00 00 00 00 01 00 00 00 08 00 04 52 45 50 37 38 20 20 20 20 20 20 20 +[1081] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1105] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 +[1129] 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 18 00 00 00 00 +[1153] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1177] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1201] 00 01 00 00 00 08 00 05 46 4f 52 45 49 47 4e 20 20 20 20 20 20 20 20 20 +[1225] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +[1249] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 +[1273] 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 +[1297] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1321] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 20 20 20 +[1345] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 +[1369] 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4f 42 53 20 20 20 20 20 48 45 41 44 +[1393] 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 +[1417] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 +[1441] 41 4d 43 20 20 20 20 20 44 10 03 00 00 00 00 00 42 16 00 00 00 00 00 00 +[1465] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 41 4d 43 20 20 20 20 20 +[1489] 44 12 8d 00 00 00 00 00 42 11 00 00 00 00 00 00 41 30 00 00 00 00 00 00 +[1513] 00 00 00 00 00 00 00 00 41 4d 43 20 20 20 20 20 43 ed 70 00 00 00 00 00 +[1537] 42 16 00 00 00 00 00 00 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1561] 41 75 64 69 20 20 20 20 44 25 da 00 00 00 00 00 42 11 00 00 00 00 00 00 +[1585] 41 50 00 00 00 00 00 00 41 10 00 00 00 00 00 00 41 75 64 69 20 20 20 20 +[1609] 44 18 97 00 00 00 00 00 42 17 00 00 00 00 00 00 41 30 00 00 00 00 00 00 +[1633] 41 10 00 00 00 00 00 00 42 4d 57 20 20 20 20 20 44 26 07 00 00 00 00 00 +[1657] 42 19 00 00 00 00 00 00 41 40 00 00 00 00 00 00 41 10 00 00 00 00 00 00 +[1681] 42 75 69 63 6b 20 20 20 44 12 d0 00 00 00 00 00 42 14 00 00 00 00 00 00 +[1705] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 42 75 69 63 6b 20 20 20 +[1729] 44 1e 93 00 00 00 00 00 41 f0 00 00 00 00 00 00 41 40 00 00 00 00 00 00 +[1753] 00 00 00 00 00 00 00 00 42 75 69 63 6b 20 20 20 44 16 9c 00 00 00 00 00 +[1777] 42 12 00 00 00 00 00 00 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1801] 42 75 69 63 6b 20 20 20 44 11 65 00 00 00 00 00 42 1a 00 00 00 00 00 00 +[1825] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 42 75 69 63 6b 20 20 20 +[1849] 44 14 45 00 00 00 00 00 42 14 00 00 00 00 00 00 41 30 00 00 00 00 00 00 +[1873] 00 00 00 00 00 00 00 00 42 75 69 63 6b 20 20 20 44 28 84 00 00 00 00 00 +[1897] 42 10 00 00 00 00 00 00 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[1921] 42 75 69 63 6b 20 20 20 43 ff 20 00 00 00 00 00 42 13 00 00 00 00 00 00 +[1945] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 61 64 2e 20 20 20 20 +[1969] 44 2c 79 00 00 00 00 00 41 e0 00 00 00 00 00 00 41 30 00 00 00 00 00 00 +[1993] 00 00 00 00 00 00 00 00 43 61 64 2e 20 20 20 20 44 38 a4 00 00 00 00 00 +[2017] 41 e0 00 00 00 00 00 00 41 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[2041] 43 61 64 2e 20 20 20 20 44 3e 22 00 00 00 00 00 42 15 00 00 00 00 00 00 +[2065] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 68 65 76 2e 20 20 20 +[2089] 43 ce 30 00 00 00 00 00 42 1d 00 00 00 00 00 00 41 30 00 00 00 00 00 00 +[2113] 00 00 00 00 00 00 00 00 43 68 65 76 2e 20 20 20 44 16 49 00 00 00 00 00 +[2137] 42 10 00 00 00 00 00 00 41 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[2161] 43 68 65 76 2e 20 20 20 44 11 98 00 00 00 00 00 42 16 00 00 00 00 00 00 +[2185] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 43 68 65 76 2e 20 20 20 +[2209] 44 13 f0 00 00 00 00 00 42 16 00 00 00 00 00 00 41 20 00 00 00 00 00 00 +[2233] 00 00 00 00 00 00 00 00 43 68 65 76 2e 20 20 20 43 e5 30 00 00 00 00 00 +[2257] 42 18 00 00 00 00 00 00 41 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +[2281] 43 68 65 76 2e 20 20 20 43 f7 30 00 00 00 00 00 42 13 00 00 00 00 00 00 +[2305] 41 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 61 74 73 75 6e 20 20 +[2329] 44 18 55 00 00 00 00 00 42 17 00 00 00 00 00 00 41 40 00 00 00 00 00 00 +[2353] 41 10 00 00 00 00 00 00 44 61 74 73 75 6e 20 20 44 11 ed 00 00 00 00 00 +[2377] 42 23 00 00 00 00 00 00 41 50 00 00 00 00 00 00 41 10 00 00 00 00 00 00 +[2401] 44 61 74 73 75 6e 20 20 44 13 d7 00 00 00 00 00 42 18 00 00 00 00 00 00 +[2425] 41 40 00 00 00 00 00 00 41 10 00 00 00 00 00 00 44 61 74 73 75 6e 20 20 +[2449] 44 1f c1 00 00 00 00 00 42 15 00 00 00 00 00 00 41 40 00 00 00 00 00 00 +[2473] 41 10 00 00 00 00 00 00 +> > ## Test that the files are identical > stopifnot( all(a.1 == a.2) ) > > proc.time() user system elapsed - 0.496 0.038 0.524 + 0.485 0.042 0.518 Modified: trunk/SASxport/tests/testDates.Rout.save =================================================================== --- trunk/SASxport/tests/testDates.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testDates.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -76,4 +76,4 @@ > > proc.time() user system elapsed - 0.506 0.038 0.534 + 0.519 0.040 0.554 Modified: trunk/SASxport/tests/testDuplicateNames.Rout.save =================================================================== --- trunk/SASxport/tests/testDuplicateNames.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testDuplicateNames.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -84,4 +84,4 @@ > > proc.time() user system elapsed - 0.539 0.042 0.568 + 0.499 0.039 0.526 Modified: trunk/SASxport/tests/testEmpty.Rout.save =================================================================== --- trunk/SASxport/tests/testEmpty.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testEmpty.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -84,4 +84,4 @@ > > proc.time() user system elapsed - 0.560 0.043 0.593 + 0.537 0.038 0.568 Modified: trunk/SASxport/tests/testExamples.Rout.save =================================================================== --- trunk/SASxport/tests/testExamples.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testExamples.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -968,4 +968,4 @@ > > proc.time() user system elapsed - 0.770 0.057 0.816 + 0.763 0.066 0.814 Modified: trunk/SASxport/tests/testManyNames.Rout.save =================================================================== --- trunk/SASxport/tests/testManyNames.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testManyNames.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -109,4 +109,4 @@ > > proc.time() user system elapsed - 4.964 0.063 5.039 + 4.450 0.056 4.500 Modified: trunk/SASxport/tests/testNegative.Rout.save =================================================================== --- trunk/SASxport/tests/testNegative.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testNegative.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -62,4 +62,4 @@ > > proc.time() user system elapsed - 0.610 0.045 0.644 + 0.517 0.039 0.543 Modified: trunk/SASxport/tests/testNumeric.Rout.save =================================================================== --- trunk/SASxport/tests/testNumeric.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testNumeric.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -101,4 +101,4 @@ > > proc.time() user system elapsed - 0.628 0.042 0.660 + 0.603 0.043 0.635 Modified: trunk/SASxport/tests/testUnnamedComponents.Rout.save =================================================================== --- trunk/SASxport/tests/testUnnamedComponents.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/testUnnamedComponents.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -2130,4 +2130,4 @@ > > proc.time() user system elapsed - 1.694 0.074 1.774 + 1.593 0.080 1.671 Modified: trunk/SASxport/tests/test_as_is.Rout.save =================================================================== --- trunk/SASxport/tests/test_as_is.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/test_as_is.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -85,4 +85,4 @@ > > proc.time() user system elapsed - 0.471 0.038 0.498 + 0.449 0.037 0.475 Modified: trunk/SASxport/tests/test_fields.Rout.save =================================================================== --- trunk/SASxport/tests/test_fields.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/test_fields.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -46,4 +46,4 @@ > > proc.time() user system elapsed - 0.445 0.044 0.510 + 0.387 0.034 0.409 Modified: trunk/SASxport/tests/xport.Rout.save =================================================================== --- trunk/SASxport/tests/xport.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/xport.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -120,4 +120,4 @@ > q() > proc.time() user system elapsed - 0.566 0.051 0.604 + 0.447 0.037 0.471 Modified: trunk/SASxport/tests/xxx.Rout.save =================================================================== --- trunk/SASxport/tests/xxx.Rout.save 2014-07-18 15:29:13 UTC (rev 1836) +++ trunk/SASxport/tests/xxx.Rout.save 2014-07-18 15:29:30 UTC (rev 1837) @@ -67,7 +67,7 @@ + cDate=strptime("28JUL07:21:08:06 ", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1", -+ autogen.formats=FALSE ++ autogen.formats=FALSE + ) > > @@ -81,10 +81,109 @@ > ## R doesn't have multiple NA types, while SAS does. The original > ## file contains a SAS '.A' missing value, while what we've created > ## contains an ordinary '.' missing value, so mash this one byte to -> ## avoid a comparison error for this known limitation. +> ## avoid a comparison error for this known limitation. > > a.1[1089] <- as.raw("0x2e") > +> ## Display the created files for diff +> a.2 + [1] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 + [25] 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [49] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [73] 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 + [97] 53 41 53 4c 49 42 20 20 39 2e 31 20 20 20 20 20 53 75 6e 4f 53 00 00 00 + [121] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [145] 32 38 4a 55 4c 30 37 3a 32 31 3a 30 38 3a 30 36 32 38 4a 55 4c 30 37 3a + [169] 32 31 3a 30 38 3a 30 36 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [193] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [217] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [241] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 + [265] 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [289] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 + [313] 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [337] 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [361] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [385] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 + [409] 41 42 43 20 20 20 20 20 53 41 53 44 41 54 41 20 39 2e 31 20 20 20 20 20 + [433] 53 75 6e 4f 53 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [457] 20 20 20 20 20 20 20 20 32 38 4a 55 4c 30 37 3a 32 31 3a 30 38 3a 30 36 + [481] 32 38 4a 55 4c 30 37 3a 32 31 3a 30 38 3a 30 36 20 20 20 20 20 20 20 20 + [505] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [529] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [553] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [577] 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [601] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 32 30 30 30 30 30 30 + [625] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 00 01 00 00 00 08 00 01 + [649] 58 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [673] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [697] 44 41 54 45 20 20 20 20 00 07 00 00 00 00 00 00 20 20 20 20 20 20 20 20 + [721] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [745] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [769] 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 08 00 02 59 20 20 20 + [793] 20 20 20 20 63 68 61 72 61 63 74 65 72 20 76 61 72 69 61 62 6c 65 20 20 + [817] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [841] 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 + [865] 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [889] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [913] 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [937] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [961] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4f 42 53 20 + [985] 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 +[1009] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 +[1033] 30 30 30 30 30 30 20 20 41 10 00 00 00 00 00 00 61 20 20 20 20 20 20 20 +[1057] 41 20 00 00 00 00 00 00 42 20 20 20 20 20 20 20 2e 00 00 00 00 00 00 00 +[1081] 20 20 20 20 20 20 20 20 2e 00 00 00 00 00 00 00 2a 20 20 20 20 20 20 20 +[1105] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +> +> a.3 + [1] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4c 49 42 52 + [25] 41 52 59 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [49] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [73] 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 53 41 53 20 20 20 20 20 + [97] 53 41 53 4c 49 42 20 20 39 2e 31 20 20 20 20 20 53 75 6e 4f 53 00 00 00 + [121] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [145] 32 38 4a 55 4c 30 37 3a 32 31 3a 30 38 3a 30 36 32 38 4a 55 4c 30 37 3a + [169] 32 31 3a 30 38 3a 30 36 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [193] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [217] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [241] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4d 45 4d 42 + [265] 45 52 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 + [289] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31 36 30 30 30 30 30 + [313] 30 30 30 31 34 30 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [337] 2a 2a 2a 2a 44 53 43 52 50 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [361] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 + [385] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 53 41 53 20 20 20 20 20 + [409] 41 42 43 20 20 20 20 20 53 41 53 44 41 54 41 20 39 2e 31 20 20 20 20 20 + [433] 53 75 6e 4f 53 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [457] 20 20 20 20 20 20 20 20 32 38 4a 55 4c 30 37 3a 32 31 3a 30 38 3a 30 36 + [481] 32 38 4a 55 4c 30 37 3a 32 31 3a 30 38 3a 30 36 20 20 20 20 20 20 20 20 + [505] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [529] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [553] 20 20 20 20 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a + [577] 2a 2a 2a 2a 4e 41 4d 45 53 54 52 20 48 45 41 44 45 52 20 52 45 43 4f 52 + [601] 44 21 21 21 21 21 21 21 30 30 30 30 30 30 30 30 30 32 30 30 30 30 30 30 + [625] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 20 00 01 00 00 00 08 00 01 + [649] 58 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [673] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [697] 44 41 54 45 20 20 20 20 00 07 00 00 00 00 00 00 20 20 20 20 20 20 20 20 + [721] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [745] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [769] 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 08 00 02 59 20 20 20 + [793] 20 20 20 20 63 68 61 72 61 63 74 65 72 20 76 61 72 69 61 62 6c 65 20 20 + [817] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [841] 20 20 20 20 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 00 00 00 00 + [865] 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [889] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + [913] 00 00 00 00 00 00 00 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [937] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + [961] 48 45 41 44 45 52 20 52 45 43 4f 52 44 2a 2a 2a 2a 2a 2a 2a 4f 42 53 20 + [985] 20 20 20 20 48 45 41 44 45 52 20 52 45 43 4f 52 44 21 21 21 21 21 21 21 +[1009] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 +[1033] 30 30 30 30 30 30 20 20 41 10 00 00 00 00 00 00 61 20 20 20 20 20 20 20 +[1057] 41 20 00 00 00 00 00 00 42 20 20 20 20 20 20 20 2e 00 00 00 00 00 00 00 +[1081] 20 20 20 20 20 20 20 20 2e 00 00 00 00 00 00 00 2a 20 20 20 20 20 20 20 +[1105] 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +> > ## Test that the files are otherwise identical > stopifnot( all(a.1 == a.2) ) > stopifnot( all(a.1 == a.3) ) @@ -93,4 +192,4 @@ > > proc.time() user system elapsed - 0.479 0.038 0.509 + 0.467 0.044 0.502 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 15:29:16
|
Revision: 1836 http://sourceforge.net/p/r-gregmisc/code/1836 Author: warnes Date: 2014-07-18 15:29:13 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Write file data as hex bytes so R CMD check's diff can display up differences. Modified Paths: -------------- trunk/SASxport/tests/Alfalfa_Test.R trunk/SASxport/tests/cars.R trunk/SASxport/tests/xxx.R Modified: trunk/SASxport/tests/Alfalfa_Test.R =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.R 2014-07-18 12:10:22 UTC (rev 1835) +++ trunk/SASxport/tests/Alfalfa_Test.R 2014-07-18 15:29:13 UTC (rev 1836) @@ -20,5 +20,8 @@ a.1 <- readBin( con="Alfalfa.xpt", what=raw(), n=3600 ) a.2 <- readBin( con="Alfalfa2.xpt", what=raw(), n=3600 ) +## Display for diff +a.2 + ## Test that the files are identical stopifnot( all(a.1 == a.2) ) Modified: trunk/SASxport/tests/cars.R =================================================================== --- trunk/SASxport/tests/cars.R 2014-07-18 12:10:22 UTC (rev 1835) +++ trunk/SASxport/tests/cars.R 2014-07-18 15:29:13 UTC (rev 1836) @@ -15,7 +15,7 @@ cDate=strptime("28JUL07: 20:59:49", format="%d%b%y:%H:%M:%S"), osType="SunOS", sasVer="9.1", - autogen.formats=FALSE + autogen.formats=FALSE ) @@ -23,5 +23,8 @@ a.1 <- readBin( con="cars.xpt", what=raw(), n=1e5) a.2 <- readBin( con="cars2.xpt", what=raw(), n=1e5) +## Display for diff +a.2 + ## Test that the files are identical stopifnot( all(a.1 == a.2) ) Modified: trunk/SASxport/tests/xxx.R =================================================================== --- trunk/SASxport/tests/xxx.R 2014-07-18 12:10:22 UTC (rev 1835) +++ trunk/SASxport/tests/xxx.R 2014-07-18 15:29:13 UTC (rev 1836) @@ -31,7 +31,7 @@ cDate=strptime("28JUL07:21:08:06 ", format="%d%b%y:%H:%M:%S"), osType="SunOS", sasVer="9.1", - autogen.formats=FALSE + autogen.formats=FALSE ) @@ -45,10 +45,15 @@ ## R doesn't have multiple NA types, while SAS does. The original ## file contains a SAS '.A' missing value, while what we've created ## contains an ordinary '.' missing value, so mash this one byte to -## avoid a comparison error for this known limitation. +## avoid a comparison error for this known limitation. a.1[1089] <- as.raw("0x2e") +## Display the created files for diff +a.2 + +a.3 + ## Test that the files are otherwise identical stopifnot( all(a.1 == a.2) ) stopifnot( all(a.1 == a.3) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 12:10:26
|
Revision: 1835 http://sourceforge.net/p/r-gregmisc/code/1835 Author: warnes Date: 2014-07-18 12:10:22 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Remove SASxport:::assert() and replace all uses with stopifnot() Modified Paths: -------------- trunk/SASxport/tests/Alfalfa_Test.Rout.save trunk/SASxport/tests/Theoph.Rout.save trunk/SASxport/tests/cars.Rout.save trunk/SASxport/tests/testDates.Rout.save trunk/SASxport/tests/testDuplicateNames.Rout.save trunk/SASxport/tests/testEmpty.Rout.save trunk/SASxport/tests/testExamples.Rout.save trunk/SASxport/tests/testManyNames.Rout.save trunk/SASxport/tests/testNegative.Rout.save trunk/SASxport/tests/testNumeric.Rout.save trunk/SASxport/tests/testUnnamedComponents.Rout.save trunk/SASxport/tests/test_as_is.Rout.save trunk/SASxport/tests/test_fields.Rout.save trunk/SASxport/tests/xport.Rout.save trunk/SASxport/tests/xxx.Rout.save Modified: trunk/SASxport/tests/Alfalfa_Test.Rout.save =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -34,7 +34,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -57,8 +57,8 @@ > a.2 <- readBin( con="Alfalfa2.xpt", what=raw(), n=3600 ) > > ## Test that the files are identical -> SASxport:::assert( all(a.1 == a.2) ) +> stopifnot( all(a.1 == a.2) ) > > proc.time() user system elapsed - 0.478 0.037 0.508 + 0.487 0.038 0.517 Modified: trunk/SASxport/tests/Theoph.Rout.save =================================================================== --- trunk/SASxport/tests/Theoph.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/Theoph.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -36,7 +36,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -51,10 +51,10 @@ > ## Test equality, handling the ordered factor Subject separately because > ## SAS xport files don't provide a mechanism for storing factor orders > -> SASxport:::assert( all( as.character(Theoph$Subject) == as.character(Theoph.2$Subject) )) -> SASxport:::assert( all(Theoph[,-1] == Theoph.2[,-1]) ) +> stopifnot( all( as.character(Theoph$Subject) == as.character(Theoph.2$Subject) )) +> stopifnot( all(Theoph[,-1] == Theoph.2[,-1]) ) > > > proc.time() user system elapsed - 0.639 0.039 0.683 + 0.692 0.045 0.747 Modified: trunk/SASxport/tests/cars.Rout.save =================================================================== --- trunk/SASxport/tests/cars.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/cars.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -74,8 +74,8 @@ > a.2 <- readBin( con="cars2.xpt", what=raw(), n=1e5) > > ## Test that the files are identical -> SASxport:::assert( all(a.1 == a.2) ) +> stopifnot( all(a.1 == a.2) ) > > proc.time() user system elapsed - 0.482 0.038 0.506 + 0.496 0.038 0.524 Modified: trunk/SASxport/tests/testDates.Rout.save =================================================================== --- trunk/SASxport/tests/testDates.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testDates.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -76,4 +76,4 @@ > > proc.time() user system elapsed - 0.509 0.037 0.541 + 0.506 0.038 0.534 Modified: trunk/SASxport/tests/testDuplicateNames.Rout.save =================================================================== --- trunk/SASxport/tests/testDuplicateNames.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testDuplicateNames.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -84,4 +84,4 @@ > > proc.time() user system elapsed - 0.534 0.038 0.569 + 0.539 0.042 0.568 Modified: trunk/SASxport/tests/testEmpty.Rout.save =================================================================== --- trunk/SASxport/tests/testEmpty.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testEmpty.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -84,4 +84,4 @@ > > proc.time() user system elapsed - 0.555 0.040 0.589 + 0.560 0.043 0.593 Modified: trunk/SASxport/tests/testExamples.Rout.save =================================================================== --- trunk/SASxport/tests/testExamples.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testExamples.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -968,4 +968,4 @@ > > proc.time() user system elapsed - 0.779 0.050 0.833 + 0.770 0.057 0.816 Modified: trunk/SASxport/tests/testManyNames.Rout.save =================================================================== --- trunk/SASxport/tests/testManyNames.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testManyNames.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -109,4 +109,4 @@ > > proc.time() user system elapsed - 4.563 0.056 4.649 + 4.964 0.063 5.039 Modified: trunk/SASxport/tests/testNegative.Rout.save =================================================================== --- trunk/SASxport/tests/testNegative.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testNegative.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -50,7 +50,7 @@ 1 1 -1 2 -1 1 > -> SASxport:::assert(all(df1==df2)) +> stopifnot(all(df1==df2)) > > df3 <- data.frame(x.continuous=seq(-100,100,by=0.5), x.integer=as.integer(seq(-100,100,by=0.5)) ) > write.xport(df3, file='df3.xpt') @@ -58,8 +58,8 @@ In makeSASNames(colnames(df)) : Truncated 2 long names to 8 characters. > df4 <- read.xport(file='df3.xpt') > -> SASxport:::assert(all(df3==df4)) +> stopifnot(all(df3==df4)) > > proc.time() user system elapsed - 0.530 0.036 0.560 + 0.610 0.045 0.644 Modified: trunk/SASxport/tests/testNumeric.Rout.save =================================================================== --- trunk/SASxport/tests/testNumeric.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testNumeric.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -55,7 +55,7 @@ 2: In xport.numeric(val) : IBM exponent overflow, generating NA > df.2 <- read.xport(file='testNumeric.xpt') > -> SASxport:::assert( all(df == df.2, na.rm=TRUE) ) +> stopifnot( all(df == df.2, na.rm=TRUE) ) > df.2 INTS DBLS CHAR 1 NA NA <NA> @@ -81,7 +81,7 @@ > df.2 <- read.xport(file='testNumeric.xpt') > > -> SASxport:::assert(all(df==df.2,na.rm=TRUE)) +> stopifnot(all(df==df.2,na.rm=TRUE)) > df.2 INTS DBLS CHAR 1 NA NA <NA> @@ -101,4 +101,4 @@ > > proc.time() user system elapsed - 0.615 0.037 0.645 + 0.628 0.042 0.660 Modified: trunk/SASxport/tests/testUnnamedComponents.Rout.save =================================================================== --- trunk/SASxport/tests/testUnnamedComponents.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/testUnnamedComponents.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -1444,7 +1444,7 @@ > failure <- try( write.xport(5,"a.xpt") ) #10.a Error in write.xport(5, "a.xpt") : '5', 'a.xpt' are not data.frame objects. -> SASxport:::assert( "try-error" %in% class(failure) ) #10.b +> stopifnot( "try-error" %in% class(failure) ) #10.b > (tmp <- read.xport("a.xpt")) #10.c $DATA1 RACE AGE D1 DT1 T1 @@ -1558,7 +1558,7 @@ > failure <- try( write.xport(list(a=5,b=6),"a.xpt") ) #11.a Error in write.xport(list(a = 5, b = 6), "a.xpt") : 'list(a = 5, b = 6)', 'a.xpt' are not data.frame objects. -> SASxport:::assert( "try-error" %in% class(failure) ) #11.b +> stopifnot( "try-error" %in% class(failure) ) #11.b > (tmp <- read.xport("a.xpt")) #10.c $DATA1 RACE AGE D1 DT1 T1 @@ -2130,4 +2130,4 @@ > > proc.time() user system elapsed - 1.648 0.070 1.728 + 1.694 0.074 1.774 Modified: trunk/SASxport/tests/test_as_is.Rout.save =================================================================== --- trunk/SASxport/tests/test_as_is.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/test_as_is.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -65,7 +65,7 @@ - attr(*, "label")= chr " " - attr(*, "SAStype")= chr " " > -> SASxport:::assert( class(x$STATE)=="factor" ) +> stopifnot( class(x$STATE)=="factor" ) > > ## When as.is=TRUE, character variable "STATE" should be preserved as > ## a character variable. @@ -79,10 +79,10 @@ - attr(*, "label")= chr " " - attr(*, "SAStype")= chr " " > -> SASxport:::assert( class(x$STATE)=="character" ) +> stopifnot( class(x$STATE)=="character" ) > > > > proc.time() user system elapsed - 0.465 0.036 0.495 + 0.471 0.038 0.498 Modified: trunk/SASxport/tests/test_fields.Rout.save =================================================================== --- trunk/SASxport/tests/test_fields.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/test_fields.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -42,8 +42,8 @@ > .C("doTest",PACKAGE="SASxport") list() > -> ## Successful completion means all SASxport:::assertions have been met +> ## Successful completion means all assertions have been met > > proc.time() user system elapsed - 0.404 0.035 0.431 + 0.445 0.044 0.510 Modified: trunk/SASxport/tests/xport.Rout.save =================================================================== --- trunk/SASxport/tests/xport.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/xport.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -120,4 +120,4 @@ > q() > proc.time() user system elapsed - 0.467 0.036 0.497 + 0.566 0.051 0.604 Modified: trunk/SASxport/tests/xxx.Rout.save =================================================================== --- trunk/SASxport/tests/xxx.Rout.save 2014-07-18 12:08:03 UTC (rev 1834) +++ trunk/SASxport/tests/xxx.Rout.save 2014-07-18 12:10:22 UTC (rev 1835) @@ -31,7 +31,7 @@ format.pval, round.POSIXt, trunc.POSIXt, units -Loaded SASxport version 1.4.1 (2014-07-16). +Loaded SASxport version 1.4.2 (2014-07-17). Type `?SASxport' for usage information. @@ -86,11 +86,11 @@ > a.1[1089] <- as.raw("0x2e") > > ## Test that the files are otherwise identical -> SASxport:::assert( all(a.1 == a.2) ) -> SASxport:::assert( all(a.1 == a.3) ) +> stopifnot( all(a.1 == a.2) ) +> stopifnot( all(a.1 == a.3) ) > > > > proc.time() user system elapsed - 0.454 0.038 0.482 + 0.479 0.038 0.509 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 12:08:06
|
Revision: 1834 http://sourceforge.net/p/r-gregmisc/code/1834 Author: warnes Date: 2014-07-18 12:08:03 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Remove SASxport:::assert() and replace all uses with stopifnot() Modified Paths: -------------- trunk/SASxport/DESCRIPTION trunk/SASxport/inst/NEWS trunk/SASxport/tests/Alfalfa_Test.R trunk/SASxport/tests/Theoph.R trunk/SASxport/tests/cars.R trunk/SASxport/tests/testNegative.R trunk/SASxport/tests/testNumeric.R trunk/SASxport/tests/testUnnamedComponents.R trunk/SASxport/tests/test_as_is.R trunk/SASxport/tests/test_fields.R trunk/SASxport/tests/xxx.R Removed Paths: ------------- trunk/SASxport/R/assert.R Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/DESCRIPTION 2014-07-18 12:08:03 UTC (rev 1834) @@ -1,8 +1,8 @@ Package: SASxport Type: Package Title: Read and Write SAS XPORT Files -Version: 1.4.1 -Date: 2014-07-16 +Version: 1.4.2 +Date: 2014-07-17 Description: This package provides functions for reading, listing the contents of, and writing SAS xport format files. The functions support reading and writing of either Deleted: trunk/SASxport/R/assert.R =================================================================== --- trunk/SASxport/R/assert.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/R/assert.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -1,6 +0,0 @@ -## useful function, raises an error if the FLAG expression is FALSE -assert <- function( FLAG ) - { - if(!all(FLAG)) - stop("Failed Assertion") - } Modified: trunk/SASxport/inst/NEWS =================================================================== --- trunk/SASxport/inst/NEWS 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/inst/NEWS 2014-07-18 12:08:03 UTC (rev 1834) @@ -1,3 +1,15 @@ +Version 1.4.2 - 2014-07-17 +-------------------------- + +Bug fixes: + +- Explicitly cast left shifts in ibm2ieee.c to avoid undefined + behavior. (Reported by Brian Ripley) + +- Resolve problem in accessing "Hmisc::label.default<-" if + SASxport::read.xport is called without loading SASxport. (Reported + by Dominic Comtois) + Version 1.4.1 - 2014-07-16 -------------------------- @@ -4,10 +16,10 @@ Bug fixes: - 'read.xport' now preserves '$' at the beginning of SAS character - format and iformat strings. + format and iformat strings. (Reported by Dominic Comtois) -- 'read.xport' argument names.tolower was not being honored for dataset - names. +- 'read.xport' argument names.tolower was not being honored for + dataset names. (Reported by Dominic Comtois) Version 1.4.0 - 2014-04-09 -------------------------- Modified: trunk/SASxport/tests/Alfalfa_Test.R =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/Alfalfa_Test.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -21,4 +21,4 @@ a.2 <- readBin( con="Alfalfa2.xpt", what=raw(), n=3600 ) ## Test that the files are identical -SASxport:::assert( all(a.1 == a.2) ) +stopifnot( all(a.1 == a.2) ) Modified: trunk/SASxport/tests/Theoph.R =================================================================== --- trunk/SASxport/tests/Theoph.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/Theoph.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -15,6 +15,6 @@ ## Test equality, handling the ordered factor Subject separately because ## SAS xport files don't provide a mechanism for storing factor orders -SASxport:::assert( all( as.character(Theoph$Subject) == as.character(Theoph.2$Subject) )) -SASxport:::assert( all(Theoph[,-1] == Theoph.2[,-1]) ) +stopifnot( all( as.character(Theoph$Subject) == as.character(Theoph.2$Subject) )) +stopifnot( all(Theoph[,-1] == Theoph.2[,-1]) ) Modified: trunk/SASxport/tests/cars.R =================================================================== --- trunk/SASxport/tests/cars.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/cars.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -24,4 +24,4 @@ a.2 <- readBin( con="cars2.xpt", what=raw(), n=1e5) ## Test that the files are identical -SASxport:::assert( all(a.1 == a.2) ) +stopifnot( all(a.1 == a.2) ) Modified: trunk/SASxport/tests/testNegative.R =================================================================== --- trunk/SASxport/tests/testNegative.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/testNegative.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -8,10 +8,10 @@ print(df1) print(df2) -SASxport:::assert(all(df1==df2)) +stopifnot(all(df1==df2)) df3 <- data.frame(x.continuous=seq(-100,100,by=0.5), x.integer=as.integer(seq(-100,100,by=0.5)) ) write.xport(df3, file='df3.xpt') df4 <- read.xport(file='df3.xpt') -SASxport:::assert(all(df3==df4)) +stopifnot(all(df3==df4)) Modified: trunk/SASxport/tests/testNumeric.R =================================================================== --- trunk/SASxport/tests/testNumeric.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/testNumeric.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -16,7 +16,7 @@ write.xport(df, file='testNumeric.xpt') df.2 <- read.xport(file='testNumeric.xpt') -SASxport:::assert( all(df == df.2, na.rm=TRUE) ) +stopifnot( all(df == df.2, na.rm=TRUE) ) df.2 # this gets properly handled @@ -25,6 +25,6 @@ df.2 <- read.xport(file='testNumeric.xpt') -SASxport:::assert(all(df==df.2,na.rm=TRUE)) +stopifnot(all(df==df.2,na.rm=TRUE)) df.2 Modified: trunk/SASxport/tests/testUnnamedComponents.R =================================================================== --- trunk/SASxport/tests/testUnnamedComponents.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/testUnnamedComponents.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -48,11 +48,11 @@ ### Check that we catch invalid parameters failure <- try( write.xport(5,"a.xpt") ) #10.a -SASxport:::assert( "try-error" %in% class(failure) ) #10.b +stopifnot( "try-error" %in% class(failure) ) #10.b (tmp <- read.xport("a.xpt")) #10.c failure <- try( write.xport(list(a=5,b=6),"a.xpt") ) #11.a -SASxport:::assert( "try-error" %in% class(failure) ) #11.b +stopifnot( "try-error" %in% class(failure) ) #11.b (tmp <- read.xport("a.xpt")) #10.c # Check with different list construction function *name* Modified: trunk/SASxport/tests/test_as_is.R =================================================================== --- trunk/SASxport/tests/test_as_is.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/test_as_is.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -8,7 +8,7 @@ x <- read.xport('puromycin.xpt') str(x) -SASxport:::assert( class(x$STATE)=="factor" ) +stopifnot( class(x$STATE)=="factor" ) ## When as.is=TRUE, character variable "STATE" should be preserved as ## a character variable. @@ -16,6 +16,6 @@ x <- read.xport('puromycin.xpt',as.is=TRUE) str(x) -SASxport:::assert( class(x$STATE)=="character" ) +stopifnot( class(x$STATE)=="character" ) Modified: trunk/SASxport/tests/test_fields.R =================================================================== --- trunk/SASxport/tests/test_fields.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/test_fields.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -5,4 +5,4 @@ .C("doTest",PACKAGE="SASxport") -## Successful completion means all SASxport:::assertions have been met +## Successful completion means all assertions have been met Modified: trunk/SASxport/tests/xxx.R =================================================================== --- trunk/SASxport/tests/xxx.R 2014-07-18 11:32:48 UTC (rev 1833) +++ trunk/SASxport/tests/xxx.R 2014-07-18 12:08:03 UTC (rev 1834) @@ -50,7 +50,7 @@ a.1[1089] <- as.raw("0x2e") ## Test that the files are otherwise identical -SASxport:::assert( all(a.1 == a.2) ) -SASxport:::assert( all(a.1 == a.3) ) +stopifnot( all(a.1 == a.2) ) +stopifnot( all(a.1 == a.3) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 11:32:56
|
Revision: 1833 http://sourceforge.net/p/r-gregmisc/code/1833 Author: warnes Date: 2014-07-18 11:32:48 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Explicitly cast left shifts in ibm2ieee.c to avoid undefined behavior. (Reported by Brian Ripley) Modified Paths: -------------- trunk/SASxport/src/ibm2ieee.c Modified: trunk/SASxport/src/ibm2ieee.c =================================================================== --- trunk/SASxport/src/ibm2ieee.c 2014-07-18 00:35:23 UTC (rev 1832) +++ trunk/SASxport/src/ibm2ieee.c 2014-07-18 11:32:48 UTC (rev 1833) @@ -75,8 +75,14 @@ register unsigned int left, right, signbit; register int exp; - left = (in[0]<<24) | (in[1]<<16) | (in[2]<<8) | in[3]; - right = (in[4]<<24) | (in[5]<<16) | (in[6]<<8) | in[7]; + left = ( (unsigned int) in[0]<<24) | + ( (unsigned int) in[1]<<16) | + ( (unsigned int) in[2]<<8) | + in[3]; + right = ( (unsigned int) in[4]<<24) | + ( (unsigned int) in[5]<<16) | + ( (unsigned int) in[6]<<8) | + in[7]; in += 8; exp = (left>>24) & 0x7F; /* excess 64, base 16 */ @@ -116,19 +122,19 @@ } else if( left & 0x00400000 ) { /* fix = 1; */ exp += 1023-129+1+ 3-1; - left = (left<<1) | + left = ( (unsigned int) left<<1) | ( (right>>(32-1)) & (0x7FFFFFFF>>(31-1)) ); right <<= 1; } else if( left & 0x00200000 ) { /* fix = 2; */ exp += 1023-129+1+ 3-2; - left = (left<<2) | + left = ( (unsigned int) left<<2) | ( (right>>(32-2)) & (0x7FFFFFFF>>(31-2)) ); right <<= 2; } else if( left & 0x00100000 ){ /* fix = 3; */ exp += 1023-129+1+ 3-3; - left = (left<<3) | + left = ( (unsigned int) left<<3) | ( (right>>(32-3)) & (0x7FFFFFFF>>(31-3)) ); right <<= 3; } else { @@ -138,7 +144,7 @@ * at least on the Gould. */ exp -= 4; - left = (left<<4) | (right>>(32-4)); + left = ( (unsigned int) left<<4) | (right>>(32-4)); right <<= 4; goto ibm_normalized; } @@ -147,16 +153,16 @@ if( (left & 0x00800000) == 0 ) { //fprintf(stderr, error("ibm->ieee missing 1, left=x%x\n", left); - left = (left<<1) | (right>>31); + left = ( (unsigned int) left<<1) | (right>>31); right <<= 1; goto ibm_normalized; } /* Having nearly VAX format, shift to IEEE, rounding. */ # ifdef ROUNDING - right = (left<<(32-3)) | ((right+4)>>3); + right = ( (unsigned int) left<<(32-3)) | ((right+4)>>3); # else - right = (left<<(32-3)) | (right>>3); + right = ( (unsigned int) left<<(32-3)) | (right>>3); # endif left = ((left & 0x007FFFFF)>>3) | signbit | (exp<<20); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-18 00:35:31
|
Revision: 1832 http://sourceforge.net/p/r-gregmisc/code/1832 Author: warnes Date: 2014-07-18 00:35:23 +0000 (Fri, 18 Jul 2014) Log Message: ----------- Add default label method to Hmisc import to resolve problem if SASxport::read.xport is called without loading SASxport Modified Paths: -------------- trunk/SASxport/NAMESPACE Modified: trunk/SASxport/NAMESPACE =================================================================== --- trunk/SASxport/NAMESPACE 2014-07-17 02:56:17 UTC (rev 1831) +++ trunk/SASxport/NAMESPACE 2014-07-18 00:35:23 UTC (rev 1832) @@ -2,7 +2,7 @@ importFrom(chron, chron, times) importFrom(utils, packageDescription) -importFrom(Hmisc, label, "label<-") +importFrom(Hmisc, label, label.default, "label<-", "label<-.default") export( toSAS, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-17 02:56:20
|
Revision: 1831 http://sourceforge.net/p/r-gregmisc/code/1831 Author: warnes Date: 2014-07-17 02:56:17 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Updated read.xport man page exampls to match new behavior of names.toupper Modified Paths: -------------- trunk/SASxport/man/read.xport.Rd Modified: trunk/SASxport/man/read.xport.Rd =================================================================== --- trunk/SASxport/man/read.xport.Rd 2014-07-17 02:55:02 UTC (rev 1830) +++ trunk/SASxport/man/read.xport.Rd 2014-07-17 02:56:17 UTC (rev 1831) @@ -199,14 +199,14 @@ #### data imported from SAS via read.xport() library(Hmisc) -describe(w$test) # see labels, format names for dataset test +describe(w$TEST) # see labels, format names for dataset test lapply(w, describe)# see descriptive stats in more detail for each variable -contents(w$test) # another way to see variable attributes +contents(w$TEST) # another way to see variable attributes lapply(w, contents)# show contents of individual items in more detail options(digits=7) # compare the following matrix with PROC MEANS output -t(sapply(w$z, function(x) +t(sapply(w$Z, function(x) c(Mean=mean(x),SD=sqrt(var(x)),Min=min(x),Max=max(x)))) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-17 02:55:18
|
Revision: 1830 http://sourceforge.net/p/r-gregmisc/code/1830 Author: warnes Date: 2014-07-17 02:55:02 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Modfy tests to directly call 'read.xport' instead of relying on 'examples(read.xport)'. Add test files to run 'examples(read.xport)' separately. Modified Paths: -------------- trunk/SASxport/tests/Alfalfa_Test.Rout.save trunk/SASxport/tests/Theoph.Rout.save trunk/SASxport/tests/cars.Rout.save trunk/SASxport/tests/testDates.Rout.save trunk/SASxport/tests/testDuplicateNames.R trunk/SASxport/tests/testDuplicateNames.Rout.save trunk/SASxport/tests/testEmpty.Rout.save trunk/SASxport/tests/testManyNames.Rout.save trunk/SASxport/tests/testNegative.Rout.save trunk/SASxport/tests/testNumeric.Rout.save trunk/SASxport/tests/testUnnamedComponents.R trunk/SASxport/tests/testUnnamedComponents.Rout.save trunk/SASxport/tests/test_as_is.Rout.save trunk/SASxport/tests/test_fields.Rout.save trunk/SASxport/tests/xport.Rout.save trunk/SASxport/tests/xxx.Rout.save Added Paths: ----------- trunk/SASxport/tests/testExamples.R trunk/SASxport/tests/testExamples.Rout.save Modified: trunk/SASxport/tests/Alfalfa_Test.Rout.save =================================================================== --- trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/Alfalfa_Test.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -20,9 +20,22 @@ > > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -48,4 +61,4 @@ > > proc.time() user system elapsed - 0.972 0.072 1.031 + 0.478 0.037 0.508 Modified: trunk/SASxport/tests/Theoph.Rout.save =================================================================== --- trunk/SASxport/tests/Theoph.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/Theoph.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -22,9 +22,22 @@ > > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -44,4 +57,4 @@ > > proc.time() user system elapsed - 1.656 0.112 1.878 + 0.639 0.039 0.683 Modified: trunk/SASxport/tests/cars.Rout.save =================================================================== --- trunk/SASxport/tests/cars.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/cars.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -65,4 +78,4 @@ > > proc.time() user system elapsed - 0.972 0.084 1.074 + 0.482 0.038 0.506 Modified: trunk/SASxport/tests/testDates.Rout.save =================================================================== --- trunk/SASxport/tests/testDates.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testDates.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -63,4 +76,4 @@ > > proc.time() user system elapsed - 1.168 0.116 1.716 + 0.509 0.037 0.541 Modified: trunk/SASxport/tests/testDuplicateNames.R =================================================================== --- trunk/SASxport/tests/testDuplicateNames.R 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testDuplicateNames.R 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,8 +1,9 @@ library(SASxport) Sys.setenv("TZ"="GMT") -##tests -example(read.xport) +## Read example dataset from a local file +testFile <- system.file('extdata', 'test2.xpt', package="SASxport") +w <- read.xport(testFile, names.tolower=TRUE) # Duplicate df names write.xport("AA"=w$test,"Aa"=w$test,"aA"=w$test,"aa"=w$test, file="dn.a.xpt") #1.a Modified: trunk/SASxport/tests/testDuplicateNames.Rout.save =================================================================== --- trunk/SASxport/tests/testDuplicateNames.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testDuplicateNames.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,187 +17,51 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' - Type `?SASxport' for usage information. +The following objects are masked from 'package:base': -> Sys.setenv("TZ"="GMT") -> -> ##tests -> example(read.xport) + format.pval, round.POSIXt, trunc.POSIXt, units -rd.xpr> ## ------- -rd.xpr> ## SAS code to generate test dataset: -rd.xpr> ## ------- -rd.xpr> ## libname y SASV5XPT "test2.xpt"; -rd.xpr> ## -rd.xpr> ## PROC FORMAT; VALUE race 1=green 2=blue 3=purple; RUN; -rd.xpr> ## PROC FORMAT CNTLOUT=format;RUN; * Name, e.g. 'format', unimportant; -rd.xpr> ## data test; -rd.xpr> ## LENGTH race 3 age 4; -rd.xpr> ## age=30; label age="Age at Beginning of Study"; -rd.xpr> ## race=2; -rd.xpr> ## d1='3mar2002'd ; -rd.xpr> ## dt1='3mar2002 9:31:02'dt; -rd.xpr> ## t1='11:13:45't; -rd.xpr> ## output; -rd.xpr> ## -rd.xpr> ## age=31; -rd.xpr> ## race=4; -rd.xpr> ## d1='3jun2002'd ; -rd.xpr> ## dt1='3jun2002 9:42:07'dt; -rd.xpr> ## t1='11:14:13't; -rd.xpr> ## output; -rd.xpr> ## format d1 mmddyy10. dt1 datetime. t1 time. race race.; -rd.xpr> ## run; -rd.xpr> ## data z; LENGTH x3 3 x4 4 x5 5 x6 6 x7 7 x8 8; -rd.xpr> ## DO i=1 TO 100; -rd.xpr> ## x3=ranuni(3); -rd.xpr> ## x4=ranuni(5); -rd.xpr> ## x5=ranuni(7); -rd.xpr> ## x6=ranuni(9); -rd.xpr> ## x7=ranuni(11); -rd.xpr> ## x8=ranuni(13); -rd.xpr> ## output; -rd.xpr> ## END; -rd.xpr> ## DROP i; -rd.xpr> ## RUN; -rd.xpr> ## PROC MEANS; RUN; -rd.xpr> ## PROC COPY IN=work OUT=y;SELECT test format z;RUN; *Creates test2.xpt; -rd.xpr> ## ------ -rd.xpr> -rd.xpr> ## Read this dataset from a local file: -rd.xpr> testFile <- system.file('extdata', 'test2.xpt', package="SASxport") -rd.xpr> w <- read.xport(testFile) +Loaded SASxport version 1.4.1 (2014-07-16). -rd.xpr> class(w) -[1] "list" + Type `?SASxport' for usage information. -rd.xpr> sapply(w, head) -$test - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 <NA> 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 - -$z - X3 X4 X5 X6 X7 X8 -1 0.5548096 0.9102659 0.19947292 0.7781959 0.7648077 0.90783205 -2 0.6289062 0.5950751 0.14938208 0.1996997 0.4579557 0.57161156 -3 0.5601807 0.2015537 0.87107157 0.8915819 0.8178354 0.06978889 -4 0.9301758 0.6795225 0.06470965 0.2382916 0.6756623 0.86167683 -5 0.4273071 0.5349607 0.90357235 0.7710940 0.7477446 0.13104011 -6 0.1850586 0.5198102 0.79364078 0.7873601 0.7689810 0.89166854 - - -rd.xpr> ## Not run: -rd.xpr> ##D ## Or read a copy of test2.xpt available on the web: -rd.xpr> ##D url <- 'http://biostat.mc.vanderbilt.edu/wiki/pub/Main/Hmisc/test2.xpt' -rd.xpr> ##D w <- read.xport(url) -rd.xpr> ## End(Not run) -rd.xpr> -rd.xpr> ## We can also get the dataset wrapped in a list -rd.xpr> w <- read.xport(testFile, as.list=TRUE) - -rd.xpr> class(w) -[1] "list" - -rd.xpr> sapply(w, head) -$test - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 <NA> 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 - -$z - X3 X4 X5 X6 X7 X8 -1 0.5548096 0.9102659 0.19947292 0.7781959 0.7648077 0.90783205 -2 0.6289062 0.5950751 0.14938208 0.1996997 0.4579557 0.57161156 -3 0.5601807 0.2015537 0.87107157 0.8915819 0.8178354 0.06978889 -4 0.9301758 0.6795225 0.06470965 0.2382916 0.6756623 0.86167683 -5 0.4273071 0.5349607 0.90357235 0.7710940 0.7477446 0.13104011 -6 0.1850586 0.5198102 0.79364078 0.7873601 0.7689810 0.89166854 - - -rd.xpr> ## And we can ask for the format information to be included as well. -rd.xpr> w <- read.xport(testFile, as.list=TRUE, include.formats=TRUE) - -rd.xpr> class(w) -[1] "list" - -rd.xpr> sapply(w, head) -$test - RACE AGE D1 DT1 T1 -1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 -2 <NA> 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 - -$z - X3 X4 X5 X6 X7 X8 -1 0.5548096 0.9102659 0.19947292 0.7781959 0.7648077 0.90783205 -2 0.6289062 0.5950751 0.14938208 0.1996997 0.4579557 0.57161156 -3 0.5601807 0.2015537 0.87107157 0.8915819 0.8178354 0.06978889 -4 0.9301758 0.6795225 0.06470965 0.2382916 0.6756623 0.86167683 -5 0.4273071 0.5349607 0.90357235 0.7710940 0.7477446 0.13104011 -6 0.1850586 0.5198102 0.79364078 0.7873601 0.7689810 0.89166854 - -$FORMATS - FMTNAME START END LABEL MIN MAX DEFAULT LENGTH FUZZ -1 RACE 1 1 green 1 40 6 6 1e-12 -2 RACE 2 2 blue 1 40 6 6 1e-12 -3 RACE 3 3 purple 1 40 6 6 1e-12 - PREFIX MULT FILL NOEDIT TYPE SEXCL EEXCL HLO DECSEP DIG3SEP DATATYPE LANGUAGE -1 0 0 N N N -2 0 0 N N N -3 0 0 N N N - - -rd.xpr> ## Don't show: -rd.xpr> stopifnot( is.data.frame(w)==FALSE && is.list(w)==TRUE ) - -rd.xpr> ## End Don't show -rd.xpr> -rd.xpr> -rd.xpr> ## Not run: -rd.xpr> ##D #### The Hmisc library provides many useful functions for interacting with -rd.xpr> ##D #### data imported from SAS via read.xport() -rd.xpr> ##D library(Hmisc) -rd.xpr> ##D -rd.xpr> ##D describe(w$test) # see labels, format names for dataset test -rd.xpr> ##D lapply(w, describe)# see descriptive stats in more detail for each variable -rd.xpr> ##D -rd.xpr> ##D contents(w$test) # another way to see variable attributes -rd.xpr> ##D lapply(w, contents)# show contents of individual items in more detail -rd.xpr> ##D -rd.xpr> ##D options(digits=7) # compare the following matrix with PROC MEANS output -rd.xpr> ##D t(sapply(w$z, function(x) -rd.xpr> ##D c(Mean=mean(x),SD=sqrt(var(x)),Min=min(x),Max=max(x)))) -rd.xpr> ## End(Not run) -rd.xpr> -rd.xpr> -rd.xpr> -rd.xpr> +> Sys.setenv("TZ"="GMT") > +> ## Read example dataset from a local file +> testFile <- system.file('extdata', 'test2.xpt', package="SASxport") +> w <- read.xport(testFile, names.tolower=TRUE) +> > # Duplicate df names > write.xport("AA"=w$test,"Aa"=w$test,"aA"=w$test,"aa"=w$test, file="dn.a.xpt") #1.a Warning message: In makeSASNames(dfNames) : Made 3 duplicate names unique. > read.xport("dn.a.xpt") -$aa +$AA RACE AGE D1 DT1 T1 1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 -$aa.1 +$AA.1 RACE AGE D1 DT1 T1 1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 -$aa.2 +$AA.2 RACE AGE D1 DT1 T1 1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 -$aa.3 +$AA.3 RACE AGE D1 DT1 T1 1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 2 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 @@ -220,4 +84,4 @@ > > proc.time() user system elapsed - 1.480 0.176 1.791 + 0.534 0.038 0.569 Modified: trunk/SASxport/tests/testEmpty.Rout.save =================================================================== --- trunk/SASxport/tests/testEmpty.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testEmpty.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > @@ -55,15 +68,15 @@ > stopifnot( length(names(dat)) == 3 ) > stopifnot( nrow(dat)!=0 ) > dat -$iris1 +$IRIS1 SEPAL.LE SEPAL.WI PETAL.LE PETAL.WI SPECIES 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa -$empty +$EMPTY data frame with 0 columns and 0 rows -$iris2 +$IRIS2 SEPAL.LE SEPAL.WI PETAL.LE PETAL.WI SPECIES 1 4.7 3.2 1.3 0.2 setosa 2 4.6 3.1 1.5 0.2 setosa @@ -71,4 +84,4 @@ > > proc.time() user system elapsed - 1.332 0.136 1.949 + 0.555 0.040 0.589 Added: trunk/SASxport/tests/testExamples.R =================================================================== --- trunk/SASxport/tests/testExamples.R (rev 0) +++ trunk/SASxport/tests/testExamples.R 2014-07-17 02:55:02 UTC (rev 1830) @@ -0,0 +1,12 @@ +library(SASxport) +Sys.setenv("TZ"="GMT") + +# run the examples, comparing output +example(SASformat) +example(lookup.xport) +example(makeSASNames) +example(read.xport) +example(toSAS) +example(write.xport) + + Added: trunk/SASxport/tests/testExamples.Rout.save =================================================================== --- trunk/SASxport/tests/testExamples.Rout.save (rev 0) +++ trunk/SASxport/tests/testExamples.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -0,0 +1,971 @@ + +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) + +R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. + +R is a collaborative project with many contributors. +Type 'contributors()' for more information and +'citation()' on how to cite R or R packages in publications. + +Type 'demo()' for some demos, 'help()' for on-line help, or +'help.start()' for an HTML browser interface to help. +Type 'q()' to quit R. + +> library(SASxport) +Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula + +Attaching package: 'Hmisc' + +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + + Type `?SASxport' for usage information. + +> Sys.setenv("TZ"="GMT") +> +> # run the examples, comparing output +> example(SASformat) + +SASfrm> ## Examples for vectors +SASfrm> +SASfrm> fail.time <- c(10,20) + +SASfrm> # set attributes +SASfrm> SASformat(fail.time) <- 'Numeric2' + +SASfrm> SASiformat(fail.time) <- 'Numeric2' + +SASfrm> # display individual attributes +SASfrm> SASformat(fail.time) +[1] "Numeric2" + +SASfrm> SASiformat(fail.time) +[1] "Numeric2" + +SASfrm> # display all attributes +SASfrm> attributes(fail.time) +$SASformat +[1] "Numeric2" + +$SASiformat +[1] "Numeric2" + + +SASfrm> ## SAStype only applies to data frames +SASfrm> df <- data.frame( fail.time, day=c("Mon","Tue") ) + +SASfrm> SAStype(df) <- "USER" + +SASfrm> SAStype(df) +[1] "USER" + +SASfrm> ## Example showing specification of default return value +SASfrm> a <- 70 + +SASfrm> label(a, default="no label") +[1] "no label" +> example(lookup.xport) + +lkp.xp> ## Get information about a local file +lkp.xp> alfFile <- system.file('extdata', 'Alfalfa.xpt', package='SASxport') + +lkp.xp> lookup.xport(alfFile) + +SAS xport file +-------------- +Filename: `/Users/warnes/src/r-gregmisc/SASxport.Rcheck/SASxport/extdata/Alfalfa.xpt' + +Variables in data set `SPEC': + dataset name type format flength fdigits iformat iflength ifdigits + SPEC POP character 0 0 0 0 + SPEC SAMPLE numeric 0 0 0 0 + SPEC REP numeric 0 0 0 0 + SPEC SEEDWT numeric 0 0 0 0 + SPEC HARV1 numeric 0 0 0 0 + SPEC HARV2 numeric 0 0 0 0 + label nobs + 40 + 40 + 40 + 40 + 40 + 40 + + +lkp.xp> ## Read a copy of test2.xpt available on the web: +lkp.xp> ## Not run: +lkp.xp> ##D url <- 'http://biostat.mc.vanderbilt.edu/wiki/pub/Main/Hmisc/test2.xpt' +lkp.xp> ##D w <- lookup.xport(url) +lkp.xp> ## End(Not run) +lkp.xp> ## Or use the local copy... +lkp.xp> testFile <- system.file('extdata', 'test2.xpt', package="SASxport") + +lkp.xp> w <- lookup.xport(testFile) + +lkp.xp> # display the information (calls 'print.lookup.xport') +lkp.xp> w + +SAS xport file +-------------- +Filename: `/Users/warnes/src/r-gregmisc/SASxport.Rcheck/SASxport/extdata/test2.xpt' + +Variables in data set `TEST': + dataset name type format flength fdigits iformat iflength ifdigits + TEST RACE numeric RACE 0 0 0 0 + TEST AGE numeric 0 0 0 0 + TEST D1 numeric MMDDYY 10 0 0 0 + TEST DT1 numeric DATETIME 0 0 0 0 + TEST T1 numeric TIME 0 0 0 0 + label nobs + 2 + Age at Beginning of Study 2 + 2 + 2 + 2 + +Variables in data set `FORMAT': + dataset name type format flength fdigits iformat iflength ifdigits + FORMAT FMTNAME character 0 0 0 0 + FORMAT START character 0 0 0 0 + FORMAT END character 0 0 0 0 + FORMAT LABEL character 0 0 0 0 + FORMAT MIN numeric 0 0 0 0 + FORMAT MAX numeric 0 0 0 0 + FORMAT DEFAULT numeric 0 0 0 0 + FORMAT LENGTH numeric 0 0 0 0 + FORMAT FUZZ numeric 0 0 0 0 + FORMAT PREFIX character 0 0 0 0 + FORMAT MULT numeric 0 0 0 0 + FORMAT FILL character 0 0 0 0 + FORMAT NOEDIT numeric 0 0 0 0 + FORMAT TYPE character 0 0 0 0 + FORMAT SEXCL character 0 0 0 0 + FORMAT EEXCL character 0 0 0 0 + FORMAT HLO character 0 0 0 0 + FORMAT DECSEP character 0 0 0 0 + FORMAT DIG3SEP character 0 0 0 0 + FORMAT DATATYPE character 0 0 0 0 + FORMAT LANGUAGE character 0 0 0 0 + label nobs + Format name 3 + Starting value for format 3 + Ending value for format 3 + Format value label 3 + Minimum length 3 + Maximum length 3 + Default length 3 + Format length 3 + Fuzz value 3 + Prefix characters 3 + Multiplier 3 + Fill character 3 + Is picture string noedit? 3 + Type of format 3 + Start exclusion 3 + End exclusion 3 + Additional information 3 + Decimal separator 3 + Three-digit separator 3 + Date/time/datetime? 3 + Language for date strings 3 + +Variables in data set `Z': + dataset name type format flength fdigits iformat iflength ifdigits label + Z X3 numeric 0 0 0 0 + Z X4 numeric 0 0 0 0 + Z X5 numeric 0 0 0 0 + Z X6 numeric 0 0 0 0 + Z X7 numeric 0 0 0 0 + Z X8 numeric 0 0 0 0 + nobs + 100 + 100 + 100 + 100 + 100 + 100 + + +lkp.xp> # names of data sets +lkp.xp> names(w) +[1] "TEST" "FORMAT" "Z" + +lkp.xp> # names of variables within data sets +lkp.xp> w$Z$name +[1] "X3" "X4" "X5" "X6" "X7" "X8" + +lkp.xp> # use summary +lkp.xp> wS <- summary(w) + +lkp.xp> wS # same display + +SAS xport file +-------------- +Filename: `/Users/warnes/src/r-gregmisc/SASxport.Rcheck/SASxport/extdata/test2.xpt' + +Variables in data set `TEST': + dataset name type format flength fdigits iformat iflength ifdigits + TEST RACE numeric RACE 0 0 0 0 + TEST AGE numeric 0 0 0 0 + TEST D1 numeric MMDDYY 10 0 0 0 + TEST DT1 numeric DATETIME 0 0 0 0 + TEST T1 numeric TIME 0 0 0 0 + label nobs + 2 + Age at Beginning of Study 2 + 2 + 2 + 2 + +Variables in data set `FORMAT': + dataset name type format flength fdigits iformat iflength ifdigits + FORMAT FMTNAME character 0 0 0 0 + FORMAT START character 0 0 0 0 + FORMAT END character 0 0 0 0 + FORMAT LABEL character 0 0 0 0 + FORMAT MIN numeric 0 0 0 0 + FORMAT MAX numeric 0 0 0 0 + FORMAT DEFAULT numeric 0 0 0 0 + FORMAT LENGTH numeric 0 0 0 0 + FORMAT FUZZ numeric 0 0 0 0 + FORMAT PREFIX character 0 0 0 0 + FORMAT MULT numeric 0 0 0 0 + FORMAT FILL character 0 0 0 0 + FORMAT NOEDIT numeric 0 0 0 0 + FORMAT TYPE character 0 0 0 0 + FORMAT SEXCL character 0 0 0 0 + FORMAT EEXCL character 0 0 0 0 + FORMAT HLO character 0 0 0 0 + FORMAT DECSEP character 0 0 0 0 + FORMAT DIG3SEP character 0 0 0 0 + FORMAT DATATYPE character 0 0 0 0 + FORMAT LANGUAGE character 0 0 0 0 + label nobs + Format name 3 + Starting value for format 3 + Ending value for format 3 + Format value label 3 + Minimum length 3 + Maximum length 3 + Default length 3 + Format length 3 + Fuzz value 3 + Prefix characters 3 + Multiplier 3 + Fill character 3 + Is picture string noedit? 3 + Type of format 3 + Start exclusion 3 + End exclusion 3 + Additional information 3 + Decimal separator 3 + Three-digit separator 3 + Date/time/datetime? 3 + Language for date strings 3 + +Variables in data set `Z': + dataset name type format flength fdigits iformat iflength ifdigits label + Z X3 numeric 0 0 0 0 + Z X4 numeric 0 0 0 0 + Z X5 numeric 0 0 0 0 + Z X6 numeric 0 0 0 0 + Z X7 numeric 0 0 0 0 + Z X8 numeric 0 0 0 0 + nobs + 100 + 100 + 100 + 100 + 100 + 100 + + +lkp.xp> # variable names within all data sets +lkp.xp> wS$name + [1] RACE AGE D1 DT1 T1 FMTNAME START END + [9] LABEL MIN MAX DEFAULT LENGTH FUZZ PREFIX MULT +[17] FILL NOEDIT TYPE SEXCL EEXCL HLO DECSEP DIG3SEP +[25] DATATYPE LANGUAGE X3 X4 X5 X6 X7 X8 +32 Levels: AGE D1 DT1 RACE T1 DATATYPE DECSEP DEFAULT DIG3SEP EEXCL ... X8 +> example(makeSASNames) + +mkSASN> ## Simple example: no duplicates or more than 8 characters +mkSASN> makeSASNames( c("height","weight","age","gender")) +[1] "HEIGHT" "WEIGHT" "AGE" "GENDER" + +mkSASN> ## Resolve duplicates +mkSASN> makeSASNames( c("a","a","b","b","b","c") ) +[1] "A" "A.1" "B" "B.1" "B.2" "C" + +mkSASN> ## Truncate long names +mkSASN> makeSASNames( c("alphabetic", "numeric", "alphanumeric", "whitespace")) +[1] "ALPHABET" "NUMERIC" "ALPHANUM" "WHITESPA" + +mkSASN> ## Truncate and make unique +mkSASN> makeSASNames( rep( c("aaaaaaaaaaa","bbbbbbbbbb"), each=3) ) +[1] "AAAAAA" "AAAAAA.1" "AAAAAA.2" "BBBBBB" "BBBBBB.1" "BBBBBB.2" + +mkSASN> ## Now do it quietly! +mkSASN> makeSASNames( rep( c("aaaaaaaaaaa","bbbbbbbbbb"), each=3), quiet=TRUE) +[1] "AAAAAA" "AAAAAA.1" "AAAAAA.2" "BBBBBB" "BBBBBB.1" "BBBBBB.2" +Warning messages: +1: In makeSASNames(c("a", "a", "b", "b", "b", "c")) : + Made 3 duplicate names unique. +2: In makeSASNames(c("alphabetic", "numeric", "alphanumeric", "whitespace")) : + Truncated 3 long names to 8 characters. +3: In makeSASNames(rep(c("aaaaaaaaaaa", "bbbbbbbbbb"), each = 3)) : + Truncated 6 long names to 8 characters. +4: In makeSASNames(rep(c("aaaaaaaaaaa", "bbbbbbbbbb"), each = 3)) : + Made 4 duplicate names unique. +> example(read.xport) + +rd.xpr> ## ------- +rd.xpr> ## SAS code to generate test dataset: +rd.xpr> ## ------- +rd.xpr> ## libname y SASV5XPT "test2.xpt"; +rd.xpr> ## +rd.xpr> ## PROC FORMAT; VALUE race 1=green 2=blue 3=purple; RUN; +rd.xpr> ## PROC FORMAT CNTLOUT=format;RUN; * Name, e.g. 'format', unimportant; +rd.xpr> ## data test; +rd.xpr> ## LENGTH race 3 age 4; +rd.xpr> ## age=30; label age="Age at Beginning of Study"; +rd.xpr> ## race=2; +rd.xpr> ## d1='3mar2002'd ; +rd.xpr> ## dt1='3mar2002 9:31:02'dt; +rd.xpr> ## t1='11:13:45't; +rd.xpr> ## output; +rd.xpr> ## +rd.xpr> ## age=31; +rd.xpr> ## race=4; +rd.xpr> ## d1='3jun2002'd ; +rd.xpr> ## dt1='3jun2002 9:42:07'dt; +rd.xpr> ## t1='11:14:13't; +rd.xpr> ## output; +rd.xpr> ## format d1 mmddyy10. dt1 datetime. t1 time. race race.; +rd.xpr> ## run; +rd.xpr> ## data z; LENGTH x3 3 x4 4 x5 5 x6 6 x7 7 x8 8; +rd.xpr> ## DO i=1 TO 100; +rd.xpr> ## x3=ranuni(3); +rd.xpr> ## x4=ranuni(5); +rd.xpr> ## x5=ranuni(7); +rd.xpr> ## x6=ranuni(9); +rd.xpr> ## x7=ranuni(11); +rd.xpr> ## x8=ranuni(13); +rd.xpr> ## output; +rd.xpr> ## END; +rd.xpr> ## DROP i; +rd.xpr> ## RUN; +rd.xpr> ## PROC MEANS; RUN; +rd.xpr> ## PROC COPY IN=work OUT=y;SELECT test format z;RUN; *Creates test2.xpt; +rd.xpr> ## ------ +rd.xpr> +rd.xpr> ## Read this dataset from a local file: +rd.xpr> testFile <- system.file('extdata', 'test2.xpt', package="SASxport") + +rd.xpr> w <- read.xport(testFile) + +rd.xpr> class(w) +[1] "list" + +rd.xpr> sapply(w, head) +$TEST + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 +2 <NA> 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + +$Z + X3 X4 X5 X6 X7 X8 +1 0.5548096 0.9102659 0.19947292 0.7781959 0.7648077 0.90783205 +2 0.6289062 0.5950751 0.14938208 0.1996997 0.4579557 0.57161156 +3 0.5601807 0.2015537 0.87107157 0.8915819 0.8178354 0.06978889 +4 0.9301758 0.6795225 0.06470965 0.2382916 0.6756623 0.86167683 +5 0.4273071 0.5349607 0.90357235 0.7710940 0.7477446 0.13104011 +6 0.1850586 0.5198102 0.79364078 0.7873601 0.7689810 0.89166854 + + +rd.xpr> ## Not run: +rd.xpr> ##D ## Or read a copy of test2.xpt available on the web: +rd.xpr> ##D url <- 'http://biostat.mc.vanderbilt.edu/wiki/pub/Main/Hmisc/test2.xpt' +rd.xpr> ##D w <- read.xport(url) +rd.xpr> ## End(Not run) +rd.xpr> +rd.xpr> ## We can also get the dataset wrapped in a list +rd.xpr> w <- read.xport(testFile, as.list=TRUE) + +rd.xpr> class(w) +[1] "list" + +rd.xpr> sapply(w, head) +$TEST + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 +2 <NA> 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + +$Z + X3 X4 X5 X6 X7 X8 +1 0.5548096 0.9102659 0.19947292 0.7781959 0.7648077 0.90783205 +2 0.6289062 0.5950751 0.14938208 0.1996997 0.4579557 0.57161156 +3 0.5601807 0.2015537 0.87107157 0.8915819 0.8178354 0.06978889 +4 0.9301758 0.6795225 0.06470965 0.2382916 0.6756623 0.86167683 +5 0.4273071 0.5349607 0.90357235 0.7710940 0.7477446 0.13104011 +6 0.1850586 0.5198102 0.79364078 0.7873601 0.7689810 0.89166854 + + +rd.xpr> ## And we can ask for the format information to be included as well. +rd.xpr> w <- read.xport(testFile, as.list=TRUE, include.formats=TRUE) + +rd.xpr> class(w) +[1] "list" + +rd.xpr> sapply(w, head) +$TEST + RACE AGE D1 DT1 T1 +1 blue 30 2002-03-03 (03 Mar 2002 09:31:02) 11:13:45 +2 <NA> 31 2002-06-03 (03 Jun 2002 09:42:07) 11:14:13 + +$Z + X3 X4 X5 X6 X7 X8 +1 0.5548096 0.9102659 0.19947292 0.7781959 0.7648077 0.90783205 +2 0.6289062 0.5950751 0.14938208 0.1996997 0.4579557 0.57161156 +3 0.5601807 0.2015537 0.87107157 0.8915819 0.8178354 0.06978889 +4 0.9301758 0.6795225 0.06470965 0.2382916 0.6756623 0.86167683 +5 0.4273071 0.5349607 0.90357235 0.7710940 0.7477446 0.13104011 +6 0.1850586 0.5198102 0.79364078 0.7873601 0.7689810 0.89166854 + +$FORMATS + FMTNAME START END LABEL MIN MAX DEFAULT LENGTH FUZZ +1 RACE 1 1 green 1 40 6 6 1e-12 +2 RACE 2 2 blue 1 40 6 6 1e-12 +3 RACE 3 3 purple 1 40 6 6 1e-12 + PREFIX MULT FILL NOEDIT TYPE SEXCL EEXCL HLO DECSEP DIG3SEP DATATYPE LANGUAGE +1 0 0 N N N +2 0 0 N N N +3 0 0 N N N + + +rd.xpr> ## Don't show: +rd.xpr> stopifnot( is.data.frame(w)==FALSE && is.list(w)==TRUE ) + +rd.xpr> ## End Don't show +rd.xpr> +rd.xpr> +rd.xpr> #### The Hmisc library provides many useful functions for interacting with +rd.xpr> #### data imported from SAS via read.xport() +rd.xpr> library(Hmisc) + +rd.xpr> describe(w$TEST) # see labels, format names for dataset test +w$TEST + + 5 Variables 2 Observations +-------------------------------------------------------------------------------- +RACE + n missing unique value + 1 1 1 blue +-------------------------------------------------------------------------------- +AGE : Age at Beginning of Study + n missing unique Mean + 2 0 2 30.5 + +30 (1, 50%), 31 (1, 50%) +-------------------------------------------------------------------------------- +D1 + n missing unique + 2 0 2 + +2002-03-03 (1, 50%), 2002-06-03 (1, 50%) +-------------------------------------------------------------------------------- +DT1 Format:day mon year h:m:s + n missing unique + 2 0 2 + Mean +(18 Apr 2002 09:36:35) + +(03 Jun 2002 09:42:07) (1, 50%) +(03 Mar 2002 09:31:02) (1, 50%) +-------------------------------------------------------------------------------- +T1 Format:h:m:s + n missing unique Mean + 2 0 2 :01: + +11:13:45 (1, 50%), 11:14:13 (1, 50%) +-------------------------------------------------------------------------------- + +rd.xpr> lapply(w, describe)# see descriptive stats in more detail for each variable +$TEST +X[[1]] + + 5 Variables 2 Observations +-------------------------------------------------------------------------------- +RACE + n missing unique value + 1 1 1 blue +-------------------------------------------------------------------------------- +AGE : Age at Beginning of Study + n missing unique Mean + 2 0 2 30.5 + +30 (1, 50%), 31 (1, 50%) +-------------------------------------------------------------------------------- +D1 + n missing unique + 2 0 2 + +2002-03-03 (1, 50%), 2002-06-03 (1, 50%) +-------------------------------------------------------------------------------- +DT1 Format:day mon year h:m:s + n missing unique + 2 0 2 + Mean +(18 Apr 2002 09:36:35) + +(03 Jun 2002 09:42:07) (1, 50%) +(03 Mar 2002 09:31:02) (1, 50%) +-------------------------------------------------------------------------------- +T1 Format:h:m:s + n missing unique Mean + 2 0 2 :01: + +11:13:45 (1, 50%), 11:14:13 (1, 50%) +-------------------------------------------------------------------------------- + +$Z +X[[2]] + + 6 Variables 100 Observations +-------------------------------------------------------------------------------- +X3 + n missing unique Mean .05 .10 .25 .50 .75 .90 + 100 0 100 0.5131 0.05585 0.13304 0.26428 0.51257 0.80719 0.93059 + .95 +0.96426 + +lowest : 0.00576 0.01524 0.02380 0.02627 0.05351 +highest: 0.96948 0.97473 0.98010 0.98096 0.99390 +-------------------------------------------------------------------------------- +X4 + n missing unique Mean .05 .10 .25 .50 .75 .90 + 100 0 100 0.5119 0.06694 0.09393 0.22310 0.49638 0.82109 0.92206 + .95 +0.94963 + +lowest : 0.02636 0.02890 0.02926 0.03010 0.05395 +highest: 0.95790 0.96828 0.97047 0.97466 0.98267 +-------------------------------------------------------------------------------- +X5 + n missing unique Mean .05 .10 .25 .50 .75 .90 + 100 0 100 0.4888 0.04286 0.06765 0.19898 0.46766 0.77899 0.89237 + .95 +0.91886 + +lowest : 0.004134 0.007872 0.008811 0.038577 0.039260 +highest: 0.933789 0.975597 0.984074 0.996114 0.997253 +-------------------------------------------------------------------------------- +X6 + n missing unique Mean .05 .10 .25 .50 .75 .90 + 100 0 100 0.4987 0.09022 0.18649 0.26865 0.46423 0.72667 0.85553 + .95 +0.93149 + +lowest : 0.01010 0.01943 0.03064 0.05931 0.08775 +highest: 0.93330 0.96090 0.97310 0.97840 0.99511 +-------------------------------------------------------------------------------- +X7 + n missing unique Mean .05 .10 .25 .50 .75 .90 + 100 0 100 0.5533 0.0850 0.1474 0.3313 0.5666 0.8120 0.9176 + .95 + 0.9517 + +lowest : 0.04201 0.04716 0.04986 0.05864 0.07641 +highest: 0.96377 0.97244 0.97413 0.99318 0.99791 +-------------------------------------------------------------------------------- +X8 + n missing unique Mean .05 .10 .25 .50 .75 .90 + 100 0 100 0.4809 0.04251 0.06831 0.27122 0.49223 0.71333 0.87322 + .95 +0.91886 + +lowest : 0.007269 0.010586 0.013044 0.018595 0.039906 +highest: 0.930491 0.935669 0.936941 0.958679 0.959636 +-------------------------------------------------------------------------------- + +$FORMATS +X[[3]] + + 21 Variables 3 Observations +-------------------------------------------------------------------------------- +FMTNAME + n missing unique value + 3 0 1 RACE +-------------------------------------------------------------------------------- +START + n missing unique + 3 0 3 + + 1 (1, 33%), 2 (1, 33%) + 3 (1, 33%) +-------------------------------------------------------------------------------- +END + n missing unique + 3 0 3 + + 1 (1, 33%), 2 (1, 33%) + 3 (1, 33%) +-------------------------------------------------------------------------------- +LABEL + n missing unique + 3 0 3 + +blue (1, 33%), green (1, 33%), purple (1, 33%) +-------------------------------------------------------------------------------- +MIN + n missing unique Mean + 3 0 1 1 +-------------------------------------------------------------------------------- +MAX + n missing unique Mean + 3 0 1 40 +-------------------------------------------------------------------------------- +DEFAULT + n missing unique Mean + 3 0 1 6 +-------------------------------------------------------------------------------- +LENGTH + n missing unique Mean + 3 0 1 6 +-------------------------------------------------------------------------------- +FUZZ + n missing unique Mean + 3 0 1 1e-12 +-------------------------------------------------------------------------------- +MULT + n missing unique Mean + 3 0 1 0 +-------------------------------------------------------------------------------- +NOEDIT + n missing unique Mean + 3 0 1 0 +-------------------------------------------------------------------------------- +TYPE + n missing unique value + 3 0 1 N +-------------------------------------------------------------------------------- +SEXCL + n missing unique value + 3 0 1 N +-------------------------------------------------------------------------------- +EEXCL + n missing unique value + 3 0 1 N +-------------------------------------------------------------------------------- + +Variables with all observations missing: + +[1] PREFIX FILL HLO DECSEP DIG3SEP DATATYPE LANGUAGE + + +rd.xpr> contents(w$TEST) # another way to see variable attributes + +Data frame:w$TEST 2 observations and 5 variables Maximum # NAs:1 + + Labels Levels Class Storage NAs +RACE 3 integer 1 +AGE Age at Beginning of Study integer integer 0 +D1 Date double 0 +DT1 chron double 0 +T1 times double 0 + ++--------+-----------------+ +|Variable|Levels | ++--------+-----------------+ +| RACE |green,blue,purple| ++--------+-----------------+ + +rd.xpr> lapply(w, contents)# show contents of individual items in more detail +$TEST + +Data frame:X[[1L]] 2 observations and 5 variables Maximum # NAs:1 + + Labels Levels Class Storage NAs +RACE 3 integer 1 +AGE Age at Beginning of Study integer integer 0 +D1 Date double 0 +DT1 chron double 0 +T1 times double 0 + ++--------+-----------------+ +|Variable|Levels | ++--------+-----------------+ +| RACE |green,blue,purple| ++--------+-----------------+ + +$Z + +Data frame:X[[2L]] 100 observations and 6 variables Maximum # NAs:0 + + Storage +X3 double +X4 double +X5 double +X6 double +X7 double +X8 double + +$FORMATS + +Data frame:X[[3L]] 3 observations and 21 variables Maximum # NAs:0 + + Storage +FMTNAME character +START character +END character +LABEL character +MIN double +MAX double +DEFAULT double +LENGTH double +FUZZ double +PREFIX character +MULT double +FILL character +NOEDIT double +TYPE character +SEXCL character +EEXCL character +HLO character +DECSEP character +DIG3SEP character +DATATYPE character +LANGUAGE character + + +rd.xpr> options(digits=7) # compare the following matrix with PROC MEANS output + +rd.xpr> t(sapply(w$Z, function(x) +rd.xpr+ c(Mean=mean(x),SD=sqrt(var(x)),Min=min(x),Max=max(x)))) + Mean SD Min Max +X3 0.5131445 0.2944341 0.005760193 0.9938965 +X4 0.5119257 0.3100749 0.026361614 0.9826741 +X5 0.4887739 0.3141976 0.004133753 0.9972528 +X6 0.4986746 0.2710817 0.010095772 0.9951080 +X7 0.5533156 0.2843679 0.042010437 0.9979081 +X8 0.4809487 0.2892945 0.007268806 0.9596358 +> example(toSAS) + +toSAS> #### +toSAS> ## See how an R date/time object will be stored in a SAS xport file: +toSAS> #### +toSAS> +toSAS> # Date and time +toSAS> dateTimeObj <- ISOdate(2007,08,01,10,14,37) + +toSAS> class(dateTimeObj) +[1] "POSIXct" "POSIXt" + +toSAS> dateTimeObj +[1] "2007-08-01 10:14:37 GMT" + +toSAS> sasDateTimeObj <- toSAS(dateTimeObj) + +toSAS> sasDateTimeObj +[1] 1501582477 +attr(,"tzone") +[1] "GMT" +attr(,"SASformat") +[1] "DATETIME16." + +toSAS> # Now just the date portion +toSAS> dateObj <- as.Date(dateTimeObj) + +toSAS> dateObj +[1] "2007-08-01" + +toSAS> sasDateObj <- toSAS(dateObj) + +toSAS> sasDateObj +[1] 17379 +attr(,"SASformat") +[1] "DATE9." + +toSAS> #### +toSAS> ## Create a new R object class based on factor to hold color names +toSAS> #### +toSAS> colorFactor <- function(x) # constructor +toSAS+ { +toSAS+ retval <- factor(x, levels=c("Red","Green","Blue") ) +toSAS+ class(retval) <- c("colorFactor","factor") +toSAS+ retval +toSAS+ } + +toSAS> ## create one and look at it +toSAS> cf <- colorFactor( c("Red","Red","Blue",NA) ) + +toSAS> cf +[1] Red Red Blue <NA> +Levels: Red Green Blue + +toSAS> ## See how it will be represented in a SAS xport file +toSAS> toSAS(cf) +[1] "Red" "Red" "Blue" NA + +toSAS> ## Create a new conversion function to store as a RGB hex value +toSAS> toSAS.colorFactor <- function(x, format="") +toSAS+ { +toSAS+ retval <- ifelse(x=="Red", "#FF0000", +toSAS+ ifelse(x=="Green", "#00FF00", "#0000FF") ) +toSAS+ attr(retval, "SASformat") <- format +toSAS+ retval +toSAS+ } + +toSAS> ## see it in action +toSAS> toSAS(cf) +[1] "#FF0000" "#FF0000" "#0000FF" NA +attr(,"SASformat") +[1] "" +> example(write.xport) + +wrt.xp> ##### +wrt.xp> ## R version of the example given in TS-140 +wrt.xp> ##### +wrt.xp> +wrt.xp> ## manually create a data set +wrt.xp> abc <- data.frame( x=c(1, 2, NA, NA ), y=c('a', 'B', NA, '*' ) ) + +wrt.xp> ## look at it +wrt.xp> abc + x y +1 1 a +2 2 B +3 NA <NA> +4 NA * + +wrt.xp> ## add a format specifier (not used by R) +wrt.xp> SASformat(abc$x) <- 'date7.' + +wrt.xp> ## add a variable label (not used by R) +wrt.xp> label(abc$y) <- 'character variable' + +wrt.xp> ## add a dataset label and type +wrt.xp> label(abc) <- 'Simple example' + +wrt.xp> SAStype(abc) <- 'MYTYPE' + +wrt.xp> ## verify the additions +wrt.xp> str(abc) +'data.frame': 4 obs. of 2 variables: + $ x: atomic 1 2 NA NA + ..- attr(*, "SASformat")= chr "date7." + $ y: Factor w/ 3 levels "*","B","a": 3 2 NA 1 + ..- attr(*, "label")= chr "character variable" + - attr(*, "label")= chr "Simple example" + - attr(*, "SAStype")= chr "MYTYPE" + +wrt.xp> # create a SAS XPORT file +wrt.xp> write.xport( abc, file="xxx.dat" ) + +wrt.xp> # list the contents of the file +wrt.xp> lookup.xport("xxx.dat") + +SAS xport file +-------------- +Filename: `xxx.dat' + +Variables in data set `ABC': + dataset name type format flength fdigits iformat iflength ifdigits + ABC X numeric DATE 7 0 0 0 + ABC Y numeric RFMTA 0 0 0 0 + label nobs + 4 + character variable 4 + +Variables in data set `FORMATS': + dataset name type format flength fdigits iformat iflength ifdigits + FORMATS FMTNAME character 0 0 0 0 + FORMATS START character 0 0 0 0 + FORMATS END character 0 0 0 0 + FORMATS LABEL character 0 0 0 0 + FORMATS MIN numeric 0 0 0 0 + FORMATS MAX numeric 0 0 0 0 + FORMATS DEFAULT numeric 0 0 0 0 + FORMATS LENGTH numeric 0 0 0 0 + FORMATS FUZZ numeric 0 0 0 0 + FORMATS PREFIX character 0 0 0 0 + FORMATS MULT numeric 0 0 0 0 + FORMATS FILL character 0 0 0 0 + FORMATS NOEDIT numeric 0 0 0 0 + FORMATS TYPE character 0 0 0 0 + FORMATS SEXCL character 0 0 0 0 + FORMATS EEXCL character 0 0 0 0 + FORMATS HLO character 0 0 0 0 + FORMATS DECSEP character 0 0 0 0 + FORMATS DIG3SEP character 0 0 0 0 + FORMATS DATATYPE character 0 0 0 0 + FORMATS LANGUAGE character 0 0 0 0 + label nobs + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + 3 + + +wrt.xp> ## reload the data +wrt.xp> xxx.abc <- read.xport("xxx.dat") + +wrt.xp> ## and look at it +wrt.xp> xxx.abc + X Y +1 1960-01-02 a +2 1960-01-03 B +3 <NA> <NA> +4 <NA> * + +wrt.xp> ## Check the label and type +wrt.xp> label(xxx.abc) + X Y + "" "character variable" + +wrt.xp> SAStype(xxx.abc) +[1] "MYTYPE" + +wrt.xp> ## Note that the variable names and SAS dataset type have been converted +wrt.xp> ## to uppercase +wrt.xp> +wrt.xp> +wrt.xp> +wrt.xp> +> +> +> +> proc.time() + user system elapsed + 0.779 0.050 0.833 Modified: trunk/SASxport/tests/testManyNames.Rout.save =================================================================== --- trunk/SASxport/tests/testManyNames.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testManyNames.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -38,9 +51,9 @@ There were 21 warnings (use warnings() to see them) > manyDF.in <- read.xport(file="manyDF.xport") > names(manyDF.in) - [1] "iris" "iris.1" "iris.2" "iris.3" "iris.4" "iris.5" "iris.6" - [8] "iris.7" "iris.8" "iris.9" "iris.10" "iris.11" "iris.12" "iris.13" -[15] "iris.14" "iris.15" "iris.16" "iris.17" "iris.18" "iris.19" + [1] "IRIS" "IRIS.1" "IRIS.2" "IRIS.3" "IRIS.4" "IRIS.5" "IRIS.6" + [8] "IRIS.7" "IRIS.8" "IRIS.9" "IRIS.10" "IRIS.11" "IRIS.12" "IRIS.13" +[15] "IRIS.14" "IRIS.15" "IRIS.16" "IRIS.17" "IRIS.18" "IRIS.19" > head(manyDF.in[[ncopies]]) SEPAL.LE SEPAL.WI PETAL.LE PETAL.WI SPECIES 1 5.1 3.5 1.4 0.2 setosa @@ -96,4 +109,4 @@ > > proc.time() user system elapsed - 19.200 0.208 19.802 + 4.563 0.056 4.649 Modified: trunk/SASxport/tests/testNegative.Rout.save =================================================================== --- trunk/SASxport/tests/testNegative.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testNegative.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -49,4 +62,4 @@ > > proc.time() user system elapsed - 1.300 0.128 1.982 + 0.530 0.036 0.560 Modified: trunk/SASxport/tests/testNumeric.Rout.save =================================================================== --- trunk/SASxport/tests/testNumeric.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testNumeric.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required package: Formula -Loaded SASxport version 1.3.6 (2013-10-09). +Attaching package: 'Hmisc' +The following objects are masked from 'package:base': + + format.pval, round.POSIXt, trunc.POSIXt, units + + +Loaded SASxport version 1.4.1 (2014-07-16). + Type `?SASxport' for usage information. > Sys.setenv("TZ"="GMT") @@ -88,4 +101,4 @@ > > proc.time() user system elapsed - 1.636 0.104 1.856 + 0.615 0.037 0.645 Modified: trunk/SASxport/tests/testUnnamedComponents.R =================================================================== --- trunk/SASxport/tests/testUnnamedComponents.R 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testUnnamedComponents.R 2014-07-17 02:55:02 UTC (rev 1830) @@ -3,6 +3,10 @@ ##tests example(read.xport) +## Read example dataset from a local file +testFile <- system.file('extdata', 'test2.xpt', package="SASxport") +w <- read.xport(testFile, names.tolower=TRUE) + write.xport(w$test,file="a.xpt") #1.a lookup.xport("a.xpt") #1.b (tmp <- read.xport("a.xpt")) #1.c @@ -52,13 +56,13 @@ (tmp <- read.xport("a.xpt")) #10.c # Check with different list construction function *name* -example(read.xport) +w <- read.xport(testFile, names.tolower=TRUE) write.xport(list=base::list(w$test,w$z),file="a.xpt") #11.a lookup.xport("a.xpt") #11.b (tmp <- read.xport("a.xpt")) #11.c # remove names -example(read.xport) +w <- read.xport(testFile, names.tolower=TRUE) names(w) <- NULL w[[3]] <- NULL write.xport(list=w,file="a.xpt") #12.a @@ -66,7 +70,7 @@ (tmp <- read.xport("a.xpt")) #12.c # remove variable names -example(read.xport) +w <- read.xport(testFile, names.tolower=TRUE) colnames(w[[2]]) <- rep("", length=ncol(w[[2]])) write.xport(list=w,file="a.xpt") #13.a lookup.xport("a.xpt") #13.b Modified: trunk/SASxport/tests/testUnnamedComponents.Rout.save =================================================================== --- trunk/SASxport/tests/testUnnamedComponents.Rout.save 2014-07-17 02:32:04 UTC (rev 1829) +++ trunk/SASxport/tests/testUnnamedComponents.Rout.save 2014-07-17 02:55:02 UTC (rev 1830) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -17,9 +17,22 @@ > library(SASxport) Loading required package: chron +Loading required package: Hmisc +Loading required package: grid +Loading required package: lattice +Loading required package: survival +Loading required package: splines +Loading required ... [truncated message content] |
From: <wa...@us...> - 2014-07-17 02:32:13
|
Revision: 1829 http://sourceforge.net/p/r-gregmisc/code/1829 Author: warnes Date: 2014-07-17 02:32:04 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Enable examples that use Hmisc, since it is now a dependency. Modified Paths: -------------- trunk/SASxport/man/read.xport.Rd Modified: trunk/SASxport/man/read.xport.Rd =================================================================== --- trunk/SASxport/man/read.xport.Rd 2014-07-17 02:16:22 UTC (rev 1828) +++ trunk/SASxport/man/read.xport.Rd 2014-07-17 02:32:04 UTC (rev 1829) @@ -26,7 +26,7 @@ variables should be returned as integers (\code{TRUE}) or doubles (\code{FALSE}). Variables outside the supported integer range (\code{.Machine$integer.max}) will always be converted to - doubles. + doubles. } \item{formats}{a data frame or list (like that created by \code{foreign:::read.xport}) containing \code{PROC FORMAT} @@ -36,7 +36,7 @@ \item{name.chars}{Vector of additional characters permissible in variable names. By default, only the alpha and numeric characters ([A-Za-z0-9]) and periods ('.') are permitted. All - other characters are converted into periods ('.'). + other characters are converted into periods ('.'). } \item{names.tolower}{Logical indicating whether variable and dataset names should be converted to lowercase (\code{TRUE}) or left @@ -45,7 +45,7 @@ \item{keep}{a vector of names of SAS datasets to process. This list must include \code{PROC FORMAT} dataset if it is present for datasets to use use any of its value label formats. - } + } \item{drop}{a vector of names of SAS datasets to ignore (original SAS upper case names) } @@ -53,7 +53,7 @@ Either a logical flag indicating whether SAS character variables should be preserved as character objects (\code{TRUE}) or factor objects (\code{FALSE}), or a fractional cutoff between 0 and 1. - + When a fractional cutoff is provided, character variables containing a more than this fraction of unique values will be stored as a character variables. This is done in order to @@ -65,12 +65,12 @@ \item{as.list}{Logical indicating whether to return a list even if the SAS xport file contains only only one dataset.} \item{include.formats}{Logical indicating whether to include SAS - format information (if present) in the returned list} + format information (if present) in the returned list} } \value{ If only a single dataset is present (after removing \code{PROC FORMAT} data when \code{include.formats=FALSE}), the return value is a single - dataframe object. Otherwise the return is a list of dataframe objects. + dataframe object. Otherwise the return is a list of dataframe objects. Note that if \code{include.formats=TRUE}, the returned list will contain a dataframe named "FORMATS" containing any available 'PROC FORMAT' @@ -79,18 +79,18 @@ \details{ \itemize{ - \item SAS date, time, and date/time variables are converted respectively to \code{Date}, + \item SAS date, time, and date/time variables are converted respectively to \code{Date}, POSIX, or \code{chron} objects - + \item SAS labels are stored in "label" attributes on each variable, and are accessible using the \code{\link{label}} function. - + \item SAS formats are stored in "SASformat" attributes on each variable, and are accessable using \code{\link{SASformat}} - + \item SAS iformats are stored in "SASiformat" attributes on each variable, and are accessable using \code{\link{SASiformat}} - + \item SAS integer variables are stored as integers unless \code{force.integer} is \code{FALSE} } @@ -105,7 +105,7 @@ functions. } \author{ Gregory R. Warnes \email{gr...@wa...} - based on \code{Hmisc:::sasxport.get} by Frank E. Harrell, Jr.} + based on \code{Hmisc:::sasxport.get} by Frank E. Harrell, Jr.} \section{Note}{ This code provides a subset of the functionality of the \code{sasxport.get} function in the Hmisc library. @@ -114,7 +114,7 @@ \code{\link[foreign]{read.xport}}, \code{\link{label}}, \code{\link[Hmisc]{sas.get}}, - \code{\link[Hmisc]{sasxport.get}}, + \code{\link[Hmisc]{sasxport.get}}, \code{\link{Dates}}, \code{\link{DateTimeClasses}}, \code{\link[chron]{chron}}, @@ -195,7 +195,6 @@ } -\dontrun{ #### The Hmisc library provides many useful functions for interacting with #### data imported from SAS via read.xport() library(Hmisc) @@ -209,7 +208,6 @@ options(digits=7) # compare the following matrix with PROC MEANS output t(sapply(w$z, function(x) c(Mean=mean(x),SD=sqrt(var(x)),Min=min(x),Max=max(x)))) -} } \keyword{interface} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-17 02:16:25
|
Revision: 1828 http://sourceforge.net/p/r-gregmisc/code/1828 Author: warnes Date: 2014-07-17 02:16:22 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Update DESCRIPTION and NEWS for SASxport 1.4.1. Modified Paths: -------------- trunk/SASxport/DESCRIPTION trunk/SASxport/inst/NEWS Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2014-07-17 02:15:45 UTC (rev 1827) +++ trunk/SASxport/DESCRIPTION 2014-07-17 02:16:22 UTC (rev 1828) @@ -1,8 +1,8 @@ Package: SASxport Type: Package Title: Read and Write SAS XPORT Files -Version: 1.4.0 -Date: 2014-04-09 +Version: 1.4.1 +Date: 2014-07-16 Description: This package provides functions for reading, listing the contents of, and writing SAS xport format files. The functions support reading and writing of either Modified: trunk/SASxport/inst/NEWS =================================================================== --- trunk/SASxport/inst/NEWS 2014-07-17 02:15:45 UTC (rev 1827) +++ trunk/SASxport/inst/NEWS 2014-07-17 02:16:22 UTC (rev 1828) @@ -1,3 +1,14 @@ +Version 1.4.1 - 2014-07-16 +-------------------------- + +Bug fixes: + +- 'read.xport' now preserves '$' at the beginning of SAS character + format and iformat strings. + +- 'read.xport' argument names.tolower was not being honored for dataset + names. + Version 1.4.0 - 2014-04-09 -------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-17 02:15:47
|
Revision: 1827 http://sourceforge.net/p/r-gregmisc/code/1827 Author: warnes Date: 2014-07-17 02:15:45 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Minor code reformatting. Modified Paths: -------------- trunk/SASxport/R/parseFormat.R trunk/SASxport/R/write.xport.R Modified: trunk/SASxport/R/parseFormat.R =================================================================== --- trunk/SASxport/R/parseFormat.R 2014-07-17 02:14:21 UTC (rev 1826) +++ trunk/SASxport/R/parseFormat.R 2014-07-17 02:15:45 UTC (rev 1827) @@ -3,7 +3,7 @@ { retval <- list("name"="", "len"=0, "digits"=0) - + if( !is.null(format) && (length(format)==1) && (format > "") ) { index <- regexpr("[0-9]+", format) @@ -16,9 +16,9 @@ else { retval$name <- substr(format,0,index-1)[1] - - lenStr <- substr(format,index, nchar(format)) - + + lenStr <- substr(format, index, nchar(format)) + index <- regexpr("\\.", lenStr) if(index==-1) { @@ -31,10 +31,10 @@ retval$digits <- as.numeric(substr(lenStr, index+1, nchar(lenStr))) } } - + if(is.na(retval$len)) retval$len <- 0 if(is.na(retval$digits)) retval$digits <- 0 - + } return(retval) Modified: trunk/SASxport/R/write.xport.R =================================================================== --- trunk/SASxport/R/write.xport.R 2014-07-17 02:14:21 UTC (rev 1826) +++ trunk/SASxport/R/write.xport.R 2014-07-17 02:15:45 UTC (rev 1827) @@ -196,15 +196,10 @@ offsetTable[i, "len"] <- varLen offsetTable[i, "offset"] <- lenIndex - - - # parse format and iformat formatInfo <- parseFormat(varFormat) iFormatInfo <- parseFormat(varIFormat) - - # write the entry out( xport.namestr( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |