[R-gregmisc-users] SF.net SVN: r-gregmisc:[1668] trunk/SASxport
Brought to you by:
warnes
From: <wa...@us...> - 2013-06-14 03:10:12
|
Revision: 1668 http://sourceforge.net/p/r-gregmisc/code/1668 Author: warnes Date: 2013-06-14 03:10:06 +0000 (Fri, 14 Jun 2013) Log Message: ----------- Fix bug when xpt file contains an empty data set Modified Paths: -------------- trunk/SASxport/R/lookup.xport.R trunk/SASxport/src/SASxport.c Modified: trunk/SASxport/R/lookup.xport.R =================================================================== --- trunk/SASxport/R/lookup.xport.R 2013-05-31 23:18:03 UTC (rev 1667) +++ trunk/SASxport/R/lookup.xport.R 2013-06-14 03:10:06 UTC (rev 1668) @@ -37,6 +37,7 @@ "label" ) ]) + if(nrow(ret)==0) ret[1,] <- NA # ensure at least one row cbind(dataset=XX, ret, nobs=df$length) } Modified: trunk/SASxport/src/SASxport.c =================================================================== --- trunk/SASxport/src/SASxport.c 2013-05-31 23:18:03 UTC (rev 1667) +++ trunk/SASxport/src/SASxport.c 2013-06-14 03:10:06 UTC (rev 1668) @@ -587,7 +587,9 @@ PROTECT(ans = allocVector(VECSXP, 0)); PROTECT(ansNames = allocVector(STRSXP, 0)); - while(namestrLength > 0 && (memLength = init_mem_info(fp, dsname, dslabel, dstype)) > 0) { + while(!feof(fp)) + { + memLength = init_mem_info(fp, dsname, dslabel, dstype); PROTECT(varInfo = allocVector(VECSXP, VAR_INFO_LENGTH)); setAttrib(varInfo, R_NamesSymbol, varInfoNames); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |