[R-gregmisc-users] SF.net SVN: r-gregmisc: [1200] trunk/SASxport
Brought to you by:
warnes
From: <wa...@us...> - 2007-10-29 15:37:08
|
Revision: 1200 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1200&view=rev Author: warnes Date: 2007-10-29 08:37:04 -0700 (Mon, 29 Oct 2007) Log Message: ----------- Fixes to correct handling storage of negative numbers Modified Paths: -------------- trunk/SASxport/DESCRIPTION trunk/SASxport/R/xport.numeric.R trunk/SASxport/inst/ChangeLog trunk/SASxport/src/ibm2ieee.c trunk/SASxport/src/ieee2ibm.c Added Paths: ----------- trunk/SASxport/tests/testNegative.R Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2007-10-29 15:35:53 UTC (rev 1199) +++ trunk/SASxport/DESCRIPTION 2007-10-29 15:37:04 UTC (rev 1200) @@ -1,8 +1,8 @@ Package: SASxport Type: Package Title: Read and Write SAS XPORT Files -Version: 1.1.1 -Date: 2007-09-25 +Version: 1.1.2 +Date: 2007-10-29 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/R/xport.numeric.R =================================================================== --- trunk/SASxport/R/xport.numeric.R 2007-10-29 15:35:53 UTC (rev 1199) +++ trunk/SASxport/R/xport.numeric.R 2007-10-29 15:37:04 UTC (rev 1200) @@ -3,7 +3,7 @@ if(length(value)!=1) stop("Only a single numeric value is permitted.") if(is.na(value)) return( xport.NA() ) - + .C("fill_numeric_field", value = as.double(value), NAOK=TRUE, Modified: trunk/SASxport/inst/ChangeLog =================================================================== --- trunk/SASxport/inst/ChangeLog 2007-10-29 15:35:53 UTC (rev 1199) +++ trunk/SASxport/inst/ChangeLog 2007-10-29 15:37:04 UTC (rev 1200) @@ -0,0 +1,398 @@ +2007-10-02 22:34 warnes + + * inst/ChangeLog, tests/Alfalfa_Test.Rout.save, + tests/TestUnnamedComponents.Rout.save, tests/Theoph.Rout.save, + tests/cars.Rout.save, tests/testDates.Rout.save, + tests/test_fields.Rout.save, tests/xport.Rout.save, + tests/xxx.Rout.save: Add information on how to get help to the + startup message + +2007-10-02 22:30 warnes + + * R/zzz.R: Add information on how to get help to the startup + message + +2007-10-02 21:21 warnes + + * NAMESPACE: Add dependenct on utils::packageDescription + +2007-10-01 20:09 warnes + + * tests/Alfalfa_Test.Rout.save, + tests/TestUnnamedComponents.Rout.save, tests/Theoph.Rout.save, + tests/cars.Rout.save, tests/testDates.Rout.save, + tests/test_fields.Rout.save, tests/xport.Rout.save, + tests/xxx.Rout.save: Update saved R output to include startup + message + +2007-09-25 19:58 warnes + + * DESCRIPTION, inst/ChangeLog: Update version number and date + +2007-09-25 19:54 warnes + + * man/SASxport-package.Rd, man/write.xport.Rd: Indicate that Metrum + partially funded development + +2007-09-25 19:53 warnes + + * R/zzz.R: Display version and support information on package load + +2007-09-18 17:42 warnes + + * DESCRIPTION: Spent more time than Metrum paid for + +2007-09-15 06:17 warnes + + * man/SASxport-package.Rd, man/lookup.xport.Rd, man/read.xport.Rd, + man/toSAS.Rd, tests/TestUnnamedComponents.Rout.save: Improve + formatting for pdf output + +2007-09-15 05:06 warnes + + * inst/ChangeLog: Update changelog + +2007-09-15 04:55 warnes + + * tests/TestUnnamedComponents.R: Changes so test + TestUnnamedCompontents.R runs under R 2.4.1 on Win32 + +2007-09-15 04:01 warnes + + * DESCRIPTION, R/make.formats.R, R/toSAS.R, R/write.xport.R, + R/xport.character.R, man/Alfalfa.Rd, man/lookup.xport.Rd, + man/toSAS.Rd, man/write.xport.Rd, tests/Alfalfa_Test.R, + tests/Alfalfa_Test.Rout.save, + tests/TestUnnamedComponents.Rout.save, tests/Theoph.Rout.save, + tests/cars.R, tests/cars.Rout.save, tests/test.xpt, + tests/testDates.Rout.save, tests/test_fields.Rout.save, + tests/xport.Rout.save, tests/xxx.R, tests/xxx.Rout.save: Add + support for auto-generating SAS formats for factor objects. + Refactor argument name handling to improve code clarity. + +2007-09-14 15:35 warnes + + * R/process.formats.R, R/read.xport.R, data, data/Alfalfa.R, + data/Alfalfa.xpt, inst/ChangeLog, man/Alfalfa.Rd, + man/lookup.xport.Rd, man/read.xport.Rd, + tests/TestUnnamedComponents.Rout.save: Add option to read.xport() + that permits inclusion of PROC CONTENTS format information in the + returned list + +2007-09-13 17:36 warnes + + * R/read.xport.R: Ensure 'names.tolower' applies to dataset names + +2007-09-13 01:55 warnes + + * tests/TestUnnamedComponents.Rout.save: Update test output to + match recent changes. + +2007-09-13 01:19 warnes + + * R/write.xport.R: Add checking and handling for unnamed data + frames or variables + +2007-09-13 01:14 warnes + + * tests/Alfalfa_Test.Rout.save, tests/TestUnnamedComponents.R, + tests/TestUnnamedComponents.Rout.save, tests/Theoph.Rout.save, + tests/cars.Rout.save, tests/testDates.Rout.save, + tests/test_fields.Rout.save, tests/xport.Rout.save, + tests/xxx.Rout.save: Update tests now that 'units' and 'units<-' + functions no longer are included + +2007-09-12 22:27 warnes + + * NAMESPACE: Remove units() and units<-() functions since they + arene't ever used. + +2007-09-12 22:25 warnes + + * R/units.R, man/label.Rd, man/units.Rd: Remove units() and + units<-() functions since they arene't ever used. + +2007-09-12 22:24 warnes + + * man/units.Rd: Remove units from manual page + +2007-09-11 23:08 warnes + + * man/read.xport.Rd: Add assertion to test that read.xport(.., + as.list=TRUE) works properly + +2007-09-11 23:05 warnes + + * R/write.xport.R: Forgot to save buffer before svn commit. + +2007-09-11 21:22 warnes + + * R/read.xport.R, man/read.xport.Rd: Correct error in handling + 'verbose' argument, error when more than one dataset has the same + name, and add 'as.list' argument to ensure return value is a + list, even if there is only one dataset in the file + +2007-09-11 21:21 warnes + + * R/write.xport.R, man/write.xport.Rd: Improve handling of list + argument. Also check that names are proper and unique. + +2007-09-07 16:47 warnes + + * tests/Theoph.R, tests/Theoph.Rout.save: Add round-trip test for + Theoph data set + +2007-09-07 16:32 warnes + + * tests/Alfalfa_Test.Rout.save, tests/cars.Rout.save, + tests/testDates.Rout.save, tests/xxx.Rout.save: Change argument + name in write.xport from 'filename' to 'file' to match read.xport + +2007-09-07 16:25 warnes + + * man/write.xport.Rd: Change argument name in write.xport from + 'filename' to 'file' to match read.xport + +2007-09-07 16:23 warnes + + * R/write.xport.R, man/read.xport.Rd, man/write.xport.Rd, + tests/Alfalfa_Test.R, tests/cars.R, tests/testDates.R, + tests/xxx.R: Change argument name in write.xport from 'filename' + to 'file' to match read.xport + +2007-09-07 16:21 warnes + + * DESCRIPTION: Fix typo + +2007-08-29 02:24 warnes + + * DESCRIPTION: Update Version to 1.0, depend on current version of + foreign + +2007-08-22 19:21 warnes + + * ChangeLog, NEWS, inst/ChangeLog, inst/NEWS: Update ChangeLog and + NEWS files + +2007-08-22 18:11 warnes + + * R/read.xport.R, man/read.xport.Rd, tests/xport.Rout.save: Modify + read.xport to preserve case of SAS names by default, as well as + updating the example code. + +2007-08-22 01:19 warnes + + * src/reverse.c: sprintf() was being used where printf() was + intended. + +2007-08-21 18:16 warnes + + * DESCRIPTION: Slight improvement to credits for BRL-CAD + +2007-08-21 18:13 warnes + + * TODO, man/lookup.xport.Rd, man/read.xport.Rd: Commit previous + updates + +2007-08-21 18:12 warnes + + * src/htond.c, src/ibm2ieee.c, src/ieee2ibm.c, src/init.c, + src/reverse.c, src/test_fields.c: Commit previous updates + +2007-08-15 07:02 warnes + + * DESCRIPTION, man/SASxport-package.Rd, src/cnxptiee.c, + src/cnxptiee.h, src/htond.c, src/init.c, src/reverse.c, + src/test_fields.c, src/writeSAS.c, src/writeSAS.h: Remove + dependency on SAS code + +2007-08-15 06:06 warnes + + * src/reverse.c: Fix reverse.c because we need to swap everything + to match Big-Endian, rather than Little-Endian. Also, dont' call + the macro. + +2007-08-15 06:04 warnes + + * src/reverse.c: Restore reverse.c + +2007-08-15 03:17 warnes + + * DESCRIPTION: Minor reformatting + +2007-08-15 03:14 warnes + + * DESCRIPTION, inst/doc/SAS_TS140.txt, inst/doc/index.html, + inst/doc/r2xpt.doc, man/SASxport-package.Rd, man/lookup.xport.Rd, + man/read.xport.Rd, man/toSAS.Rd, man/units.Rd, + man/write.xport.Rd: Make corrections for typos noted by Metrum + folks + +2007-08-12 03:22 warnes + + * DESCRIPTION, man/lookup.xport.Rd, src/cnxptiee.h, + src/test_fields.c, src/writeSAS.h: More updates + +2007-08-12 03:13 warnes + + * src/B8.h, src/IEEEtoIBM.c, src/MASKS.h, src/main.c, + src/reverse.c: Remove new stuff... use SAS's code instead + +2007-08-12 03:12 warnes + + * src/B8.h, src/IEEEtoIBM.c, src/MASKS.h, src/cnxptiee.h, + src/main.c, src/reverse.c, src/test_fields.c, src/writeSAS.h: 1st + attempt at rewriting cnxptiee.[ch] + +2007-08-11 23:48 warnes + + * R/read.xport.R: Explicitly check file header + +2007-08-11 00:03 warnes + + * DESCRIPTION, man/SASxport-package.Rd: Improve package description + +2007-08-09 23:29 warnes + + * DESCRIPTION, NAMESPACE, TODO, man/lookup.xport.Rd, + man/read.xport.Rd, man/units.Rd: More changes, esp to + lookup.xport() and friends + +2007-08-09 23:28 warnes + + * tests/Alfalfa_Test.Rout.save, tests/cars.Rout.save, + tests/xport.Rout.save: More changes, esp to lookup.xport() and + friends + +2007-08-09 23:28 warnes + + * R/AFirst.lib.s, R/all.is.numeric.R, R/in.opererator.R, + R/lookup.xport.R, R/read.xport.R, R/write.xport.R: More changes, + esp to lookup.xport() and friends + +2007-08-09 19:02 warnes + + * src/swap_bytes.h: Remove unused swap_bytes.h + +2007-08-09 19:02 warnes + + * man/SASxport-package.Rd: Add package description page + +2007-08-09 16:54 warnes + + * R/importConvertDateTime.R, R/makeNames.R, R/read.xport.R, + R/testDateTime.R: Add comment header indicating the source of + code from Hmisc + +2007-08-09 16:53 warnes + + * tests/testDates.Rout.save, tests/test_fields.Rout.save, + tests/xport.Rout.save, tests/xxx.Rout.save: Update saved output + of test scripts + +2007-08-08 18:54 warnes + + * DESCRIPTION, NAMESPACE: Updates + +2007-08-08 18:54 warnes + + * tests/Alfalfa_Test.R, tests/Alfalfa_Test.Rout.save, tests/cars.R, + tests/cars.Rout.save, tests/datetime.xpt, tests/testDates.R, + tests/test_fields.R, tests/test_fields.Rout.save, tests/xport.R, + tests/xxx.R, tests/xxx.Rout.save: Updates + +2007-08-08 18:54 warnes + + * src/SASxport.c, src/SASxport.h, src/foreign.h, src/init.c: + Updates + +2007-08-08 18:53 warnes + + * R/AFirst.lib.s, R/formats.R, R/iformat.R, + R/importConvertDateTime.R, R/label.R, R/lookup.xport.R, + R/makeNames.R, R/read.xport.R, R/testDateTime.R, R/units.R, + R/xport.R: Updates + +2007-08-08 18:53 warnes + + * man/assert.Rd, man/read.xport.Rd, man/units.Rd: Updates. + +2007-08-03 04:44 warnes + + * DESCRIPTION, NAMESPACE, R/scat.R, R/xport.R, R/zzz.R, + man/lookup.xport.Rd, man/read.xport.Rd, src/SASxport.c, + src/SASxport.h, src/cnxptiee.c, src/cnxptiee.h, src/foreign.h, + src/init.c, src/swap_bytes.h, src/test_fields.c, src/writeSAS.c, + src/writeSAS.h, tests/Alfalfa_Test.Rout.save, + tests/cars.Rout.save, tests/datetime.xpt, tests/test.xpt, + tests/testDates.Rout.save, tests/test_fields.Rout.save, + tests/xport.R, tests/xport.Rout.save, tests/xxx.Rout.save: Add + code from package foreign and gtools to make SASxport stand alone + +2007-08-03 01:46 warnes + + * R/.Rhistory: Remove stray .Rhistory file + +2007-08-03 01:45 warnes + + * DESCRIPTION: Acknowledge MetrumI support + +2007-08-03 01:45 warnes + + * NAMESPACE: Add "assert" function + +2007-08-03 01:44 warnes + + * R/assert.R, man/assert.Rd: Add "assert" function to avoid + dependenct on gtools. + +2007-08-03 01:29 warnes + + * man/toSAS.Rd, src/cnxptiee.c, src/writeSAS.c: Correct some typos. + +2007-08-03 00:40 warnes + + * DESCRIPTION: Drop version number to 0.99 until testing + integration and is complete + +2007-08-03 00:39 warnes + + * tests/test_fields.R: Add R test file to run c-level tests + +2007-08-03 00:36 warnes + + * src/SASxport.so: Remove .so from svn + +2007-08-03 00:35 warnes + + * NAMESPACE, R/fromSASDate.R, R/parseFormat.R, R/toSAS.R, + R/write.xport.R, R/xport.character.R, R/xport.file.header.R, + R/xport.member.header.R, R/xport.namestr.R, man/toSAS.Rd, + src/SASxport.so, src/writeSAS.c: More modifications. Should now + work for most R data types + +2007-08-03 00:35 warnes + + * tests/cars.R, tests/datetime.xpt, tests/testDates.R, tests/xxx.R: + Add more tests + +2007-07-29 01:15 warnes + + * tests/Alfalfa2.xpt, tests/cars.sas, tests/cars.xpt, + tests/xxx.sas, tests/xxx.xpt: Add SAS code to create xport data + files for testing + +2007-07-28 08:47 warnes + + * ., DESCRIPTION, NAMESPACE, R, R/.Rhistory, R/blanks.R, + R/rawToDisplay.R, R/write.xport.R, R/xport.NA.R, + R/xport.character.R, R/xport.dateFMT.R, R/xport.file.header.R, + R/xport.fill.R, R/xport.member.header.R, R/xport.namestr.R, + R/xport.namestr.header.R, R/xport.numeric.R, + R/xport.obs.header.R, R/zzz.R, inst, inst/doc, + inst/doc/SAS_TS140.txt, inst/doc/index.html, inst/doc/r2xpt.doc, + man, man/write.xport.Rd, src, src/SASxport.so, src/cnxptiee.c, + src/cnxptiee.h, src/test_fields.c, src/writeSAS.c, + src/writeSAS.h, tests, tests/Alfalfa.xpt, tests/Alfalfa2.xpt, + tests/Alfalfa_Test.R: Add SVNxport package + Modified: trunk/SASxport/src/ibm2ieee.c =================================================================== --- trunk/SASxport/src/ibm2ieee.c 2007-10-29 15:35:53 UTC (rev 1199) +++ trunk/SASxport/src/ibm2ieee.c 2007-10-29 15:37:04 UTC (rev 1200) @@ -86,7 +86,9 @@ signbit = left & 0x80000000; left &= 0x00FFFFFF; - if( signbit ) { + + /*if( signbit ) {*/ + if( 0 ) { /* The IBM uses 2's compliment on the mantissa, * and IEEE does not. */ Modified: trunk/SASxport/src/ieee2ibm.c =================================================================== --- trunk/SASxport/src/ieee2ibm.c 2007-10-29 15:35:53 UTC (rev 1199) +++ trunk/SASxport/src/ieee2ibm.c 2007-10-29 15:37:04 UTC (rev 1200) @@ -50,8 +50,8 @@ */ register int i; for( i=count-1; i >= 0; i-- ) { - register unsigned long left, right; - register int fix, exp, signbit; + register unsigned long 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]; @@ -59,6 +59,7 @@ exp = ((left >> 20) & 0x7FF); signbit = (left & 0x80000000) >> 24; + if( exp == 0 || exp == 0x7FF ) { ibm_undef: *out++ = 0; /* IBM zero. No NAN */ *out++ = 0; @@ -88,7 +89,8 @@ right <<= fix; } - if( signbit ) { + /* if( 0 && signbit ) { */ + if( 0 ) { /* The IBM actually uses complimented mantissa * and exponent. */ @@ -109,7 +111,6 @@ exp = (~exp) & 0x7F; } - /* Not actually required, but for comparison purposes, * normalize the number. Remove for production speed. */ Added: trunk/SASxport/tests/testNegative.R =================================================================== --- trunk/SASxport/tests/testNegative.R (rev 0) +++ trunk/SASxport/tests/testNegative.R 2007-10-29 15:37:04 UTC (rev 1200) @@ -0,0 +1,16 @@ +library(SASxport) + +df1 <- data.frame( f=c(1.0, -1.0), d=as.integer(c(-1,1) ) ) +write.xport(df1, file='df1.xpt') +df2 <- read.xport(file='df1.xpt') + +print(df1) +print(df2) + +SASxport:::assert(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)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |