Re: [R] Convert csv to xpt file in R?

2015-05-07 Thread Santosh
Dear Rxperts..
Thanks for your response. Below is the version on Windows 7 Enterprise
(64-bit) OS machine..Yes, I tried SASxport, foreign and Hmisc.. have used
SASxport before (not for writing to xpt though) and continue to have the
same write to sas transport file  issue..

 version
   _
platform   x86_64-w64-mingw32
arch   x86_64
os mingw32
system x86_64, mingw32
status
major  3
minor  0.2
year   2013
month  09
day25
svn rev63987
language   R
version.string R version 3.0.2 (2013-09-25)

Thanks and regards,
Santosh

On Thu, May 7, 2015 at 8:51 AM, Nordlund, Dan (DSHS/RDA) 
nord...@dshs.wa.gov wrote:

  -Original Message-
  From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh
  Sent: Wednesday, May 06, 2015 8:04 PM
  To: r-help
  Subject: [R] Convert csv to xpt file in R?
 
  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
 

 The code above runs without error and produces an xport file on my Win7
 64-bit system running R-3.2.0.  You haven't told us anything about your OS,
 version of R, and packages loaded.  Have you tried running the code from a
 fresh start of R after only loading the SASxport package?

 Dan

 Daniel J. Nordlund
 Research and Data Analysis Division
 Services  Enterprise Support Administration
 Washington State Department of Social and Health Services




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Convert csv to xpt file in R?

2015-05-07 Thread Nordlund, Dan (DSHS/RDA)
 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh
 Sent: Wednesday, May 06, 2015 8:04 PM
 To: r-help
 Subject: [R] Convert csv to xpt file in R?
 
 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
 

The code above runs without error and produces an xport file on my Win7 64-bit 
system running R-3.2.0.  You haven't told us anything about your OS, version of 
R, and packages loaded.  Have you tried running the code from a fresh start of 
R after only loading the SASxport package?

Dan 

Daniel J. Nordlund
Research and Data Analysis Division
Services  Enterprise Support Administration
Washington State Department of Social and Health Services


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Convert csv to xpt file in R?

2015-05-06 Thread Santosh
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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.