[R] How to this SAS transport file in R?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Dec 6 07:17:42 CET 2010
You didn't tell us your OS. That is a binary file, and from
?download.file:
mode: character. The mode with which to write the file. Useful
values are ‘"w"’, ‘"wb"’ (binary), ‘"a"’ (append) and ‘"ab"’.
Only used for the ‘"internal"’ method.
Only on Windows are the binary modes different, so it looks like you
forgot mode="wb".
On Sun, 5 Dec 2010, someone ashamed of her real name wrote:
> Dear All,
>
> I try to read the SAS transport file in R, but it shows error. Please help!
> I am using R 2.11.1
>
> library(foreign)
> download.file("http://isites.harvard.edu/fs/docs/icb.topic35387.files/demo_c.xpt","C:/Desktop/demo_c.xpt")
> sasxport <- read.xport("C:/Desktop/demo_c.xpt")
>
> Error in lookup.xport(file) : file not in SAS transfer format
[...]
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
Yes, that does mean you.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list