[R-gregmisc-users] SF.net SVN: r-gregmisc:[1657] trunk/SASxport/tests
Brought to you by:
warnes
From: <wa...@us...> - 2013-05-11 23:32:38
|
Revision: 1657 http://sourceforge.net/p/r-gregmisc/code/1657 Author: warnes Date: 2013-05-11 23:32:35 +0000 (Sat, 11 May 2013) Log Message: ----------- Fix spelling error Modified Paths: -------------- trunk/SASxport/tests/xxx.R Added Paths: ----------- trunk/SASxport/tests/dfAttributes.R Copied: trunk/SASxport/tests/dfAttributes.R (from rev 1649, trunk/SASxport/tests/xxx.R) =================================================================== --- trunk/SASxport/tests/dfAttributes.R (rev 0) +++ trunk/SASxport/tests/dfAttributes.R 2013-05-11 23:32:35 UTC (rev 1657) @@ -0,0 +1,38 @@ +library(SASxport) + +## manually create a data set +abc.out <- data.frame( x=c(1, 2, NA, NA ), y=c('a', 'B', NA, '*' ) ) + +## add a data set label (not used by R) +label(abc.out) <- "data set" +SAStype(abc.out) <- "normal" + +## add a format specifier (not used by R) +SASformat(abc.out$x) <- 'date7.' + +## add a variable label (not used by R) +label(abc.out$y) <- 'character variable' + +# create a SAS XPORT file from our local data frame +write.xport(abc.out, + file="xxx2.xpt", + cDate=strptime("28JUL07:21:08:06 ", format="%d%b%y:%H:%M:%S"), + osType="SunOS", + sasVer="9.1", + autogen.formats=FALSE + ) + +# read the SAS data back in +abc.in <- read.xport("xxx2.xpt", names.tolower=FALSE) + +## Test that the files are otherwise identical +label(abc.out, "missing!") +label(abc.in , "missing!") + +SAStype(abc.out, "missing!") +SAStype(abc.in , "missing!") + +stopifnot( label(abc.out)==label(abc.in, "missing!") ) +stopifnot( SAStype(abc.out)==SAStype(abc.in, "missing!") ) + + Modified: trunk/SASxport/tests/xxx.R =================================================================== --- trunk/SASxport/tests/xxx.R 2013-05-11 20:31:15 UTC (rev 1656) +++ trunk/SASxport/tests/xxx.R 2013-05-11 23:32:35 UTC (rev 1657) @@ -44,7 +44,7 @@ ## 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 know limitation. +## avoid a comparison error for this known limitation. a.1[1089] <- as.raw("0x2e") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |