Thread: [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. |
From: <wa...@us...> - 2013-05-11 20:11:39
|
Revision: 1654 http://sourceforge.net/p/r-gregmisc/code/1654 Author: warnes Date: 2013-05-11 20:11:36 +0000 (Sat, 11 May 2013) Log Message: ----------- Fix spelling error. Modified Paths: -------------- trunk/SASxport/R/write.xport.R trunk/SASxport/R/zzz.R Modified: trunk/SASxport/R/write.xport.R =================================================================== --- trunk/SASxport/R/write.xport.R 2013-05-11 20:10:12 UTC (rev 1653) +++ trunk/SASxport/R/write.xport.R 2013-05-11 20:11:36 UTC (rev 1654) @@ -123,8 +123,8 @@ if(file==stdout()) out <- function(...) { - cat("ASCII: ", rawToDisplay(...), "") - cat("HEX: ", ..., "") + cat("ASCII: ", rawToDisplay(...), "\n") + cat("HEX: ", ..., "\n") } else out <- function(...) writeBin( ..., raw(), con=file) @@ -159,7 +159,7 @@ out( xport.member.header(dfName=i, cDate=cDate, sasVer=sasVer, osType=osType ) ) scat("Done.") - scat("Write variable informaton block header ...") + scat("Write variable information block header ...") out( xport.namestr.header( nvar=ncol(df) ) ) scat("Done.") Modified: trunk/SASxport/R/zzz.R =================================================================== --- trunk/SASxport/R/zzz.R 2013-05-11 20:10:12 UTC (rev 1653) +++ trunk/SASxport/R/zzz.R 2013-05-11 20:11:36 UTC (rev 1654) @@ -9,7 +9,6 @@ cat("\n") } - .onLoad <- function(lib, pkg) { loadMessage() } 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. |