[R] Convert csv to xpt file in R?

Santosh santosh2005 at gmail.com
Thu May 7 05:04:21 CEST 2015


Dear Rxperts..

Was wondering if there is a way in R to read a csv file and generate an XPT
file?  For some reason the function write.xport() does not seem to work for
me....
i get the following error...
"error in label.data.frame(df,default=""): length of default same as x

A sample dataframe is given below
xg2 <- data.frame(aa=runif(10),bb=sample(runif(100),10))
SASformat(xg2$aa) <- 'Numeric2'
SASformat(xg2$bb) <- 'Numeric2'
label(xg2$aa) <- "test aa"
label(xg2$bb) <- "test bb"
label(xg2) <- "testa"
SAStype(xg2) <- "TestXge"
write.xport(xg2,file="A1.xpt")
Error in label.data.frame(df, default = "") :
  length of default must same as x


Any suggestions/tips are welcome..

Thanks and regards
Santosh

	[[alternative HTML version deleted]]



More information about the R-help mailing list