[R-gregmisc-users] SF.net SVN: r-gregmisc: [1159] trunk/SASxport
Brought to you by:
warnes
From: <wa...@us...> - 2007-08-22 18:11:59
|
Revision: 1159 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1159&view=rev Author: warnes Date: 2007-08-22 11:11:44 -0700 (Wed, 22 Aug 2007) Log Message: ----------- Modify read.xport to preserve case of SAS names by default, as well as updating the example code. Modified Paths: -------------- trunk/SASxport/R/read.xport.R trunk/SASxport/man/read.xport.Rd trunk/SASxport/tests/xport.Rout.save Modified: trunk/SASxport/R/read.xport.R =================================================================== --- trunk/SASxport/R/read.xport.R 2007-08-22 01:19:46 UTC (rev 1158) +++ trunk/SASxport/R/read.xport.R 2007-08-22 18:11:44 UTC (rev 1159) @@ -8,7 +8,7 @@ force.integer=TRUE, formats=NULL, name.chars=NULL, - names.tolower=TRUE, + names.tolower=FALSE, keep=NULL, drop=NULL, as.is=0.95, # Prevent factor conversion if 95% or more unique Modified: trunk/SASxport/man/read.xport.Rd =================================================================== --- trunk/SASxport/man/read.xport.Rd 2007-08-22 01:19:46 UTC (rev 1158) +++ trunk/SASxport/man/read.xport.Rd 2007-08-22 18:11:44 UTC (rev 1159) @@ -9,7 +9,7 @@ force.integer=TRUE, formats=NULL, name.chars=NULL, - names.tolower=TRUE, + names.tolower=FALSE, keep=NULL, drop=NULL, as.is=0.95, @@ -107,7 +107,7 @@ \code{\link[Hmisc]{describe}} } \examples{ -\dontrun{ + # ------- # SAS code to generate test dataset: # ------- @@ -149,44 +149,31 @@ # ------ # Read this dataset from a local file: +\dontrun{ w <- read.xport('test2.xpt') - -\dontshow{ -library(Hmisc) -w2 <- sasxport.get('test2.xpt') -SASxport:::assert(identical(w,w2)) } -\dontrun{ + # Or read a copy of test2.xpt available on the web: url <- 'http://biostat.mc.vanderbilt.edu/cgi-bin/viewvc.cgi/*checkout*/Hmisc/trunk/tests/test2.xpt' w <- read.xport(url) -\dontshow{ ## For testing only -SASxport:::assert(identical(w2,w)) -} -} - \dontrun{ ## The Hmisc library provides many useful functions for interacting with ## data imported from SAS via read.xport() library(Hmisc) describe(w$test) # see labels, format names for dataset test +lapply(w, describe)# see descriptive stats in more detaiil for each variable -lapply(w, describe)# see descriptive stats for both datasets - contents(w$test) # another way to see variable attributes -lapply(w, contents)# show contents of both datasets +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) c(Mean=mean(x),SD=sqrt(var(x)),Min=min(x),Max=max(x)))) - } } - -} \keyword{interface} \keyword{manip} Modified: trunk/SASxport/tests/xport.Rout.save =================================================================== --- trunk/SASxport/tests/xport.Rout.save 2007-08-22 01:19:46 UTC (rev 1158) +++ trunk/SASxport/tests/xport.Rout.save 2007-08-22 18:11:44 UTC (rev 1159) @@ -1,5 +1,5 @@ -R version 2.6.0 Under development (unstable) (2007-08-04 r42421) +R version 2.5.1 (2007-06-27) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 @@ -45,14 +45,14 @@ > Alfalfa <- read.xport("Alfalfa.xpt") > > summary(Alfalfa) - pop sample rep seedwt harv1 + POP SAMPLE REP SEEDWT HARV1 MAX:20 Min. :0.0 Min. :1.00 Min. :35.00 Min. :120.6 min:20 1st Qu.:2.0 1st Qu.:1.75 1st Qu.:47.75 1st Qu.:148.3 Median :4.5 Median :2.50 Median :59.00 Median :165.8 Mean :4.5 Mean :2.50 Mean :56.08 Mean :163.0 3rd Qu.:7.0 3rd Qu.:3.25 3rd Qu.:62.25 3rd Qu.:176.4 Max. :9.0 Max. :4.00 Max. :75.00 Max. :193.4 - harv2 + HARV2 Min. :129.1 1st Qu.:150.6 Median :163.2 @@ -75,7 +75,7 @@ > testdata <- read.xport("test.xpt") > summary(testdata) - i k + I K Min. :1.00 Min. :1 1st Qu.:1.75 1st Qu.:1 Median :2.50 Median :2 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |