[R-gregmisc-users] SF.net SVN: r-gregmisc:[1455] trunk/SASxport/R
Brought to you by:
warnes
From: <wa...@us...> - 2010-11-12 02:41:12
|
Revision: 1455 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1455&view=rev Author: warnes Date: 2010-11-12 02:41:05 +0000 (Fri, 12 Nov 2010) Log Message: ----------- Fix bug: 'as.is=TRUE' argument to read.xport was being ignored. Modified Paths: -------------- trunk/SASxport/R/read.xport.R trunk/SASxport/R/xport.R Modified: trunk/SASxport/R/read.xport.R =================================================================== --- trunk/SASxport/R/read.xport.R 2010-11-12 02:36:34 UTC (rev 1454) +++ trunk/SASxport/R/read.xport.R 2010-11-12 02:41:05 UTC (rev 1455) @@ -54,8 +54,7 @@ whichds <- setdiff(names(dsinfo), c(toupper(drop),'_CONTENTS_','_contents_')) scat("Reading the data file...") - ds <- read.xport.inner(file) - + ds <- read.xport.inner(file, stringsAsFactors=FALSE) if(any(duplicated(names(dsinfo)))) # only true if file contains has more than one data set { warning("Duplicate data set names in file. Data set names have been made unique.") @@ -106,8 +105,8 @@ names(res) <- gsub('_','.',dsn) - possiblyConvertChar <- (is.logical(as.is) && !as.is) || - (is.numeric(as.is) && as.is > 0) + possiblyConvertChar <- (is.logical(as.is) && !as.is) || + (is.numeric(as.is) && as.is > 0) j <- 0 for(k in which.regular) { j <- j + 1 Modified: trunk/SASxport/R/xport.R =================================================================== --- trunk/SASxport/R/xport.R 2010-11-12 02:36:34 UTC (rev 1454) +++ trunk/SASxport/R/xport.R 2010-11-12 02:41:05 UTC (rev 1455) @@ -24,9 +24,11 @@ lookup.xport.inner <- function(file) .Call(xport_info, file) -read.xport.inner <- function(file) { +read.xport.inner <- function(file, stringsAsFactors=FALSE) { data.info <- lookup.xport.inner(file) ans <- .Call(xport_read, file, data.info) - if (length(ans) == 1) as.data.frame(ans[[1]]) - else lapply(ans, as.data.frame) + if (length(ans) == 1) + as.data.frame(ans[[1]], stringsAsFactors=stringsAsFactors) + else + lapply(ans, as.data.frame, stringsAsFactors=stringsAsFactors) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |