[R] How to import SAS data in R?

David Winsemius dwinsemius at comcast.net
Fri Jul 6 21:06:23 CEST 2012


On Jul 6, 2012, at 2:49 PM, C W wrote:

> Hey, David
>
> table(count.fields()) is telling me have 11 columns, but I have way  
> more, more like 30 columns.
> > table(count.fields("persistency.csv"))
>
>      1      2      3      4      5      6      7      8      9     11
> 439384  39617  16130  21993  12556   1900    988    713     61      1
>

I don't usually put back the list address when responding to a private  
email, but I'm breaking my rule. You should not send private follow- 
ups for threads that start on the list unless there is something that  
other readers might not benefit from seeing.

  If it is a CSV file then you need to tell count.fields to use commas:

  table(count.fields("persistency.csv", sep=","))

-- 
David.
>
> -M
>
> On Fri, Jul 6, 2012 at 2:36 PM, David Winsemius <dwinsemius at comcast.net 
> > wrote:
>
> On Jul 6, 2012, at 1:39 PM, C W wrote:
>
> Quick question, what the memory size in R?
> I converted to CSV, but only 53300 of the 1,000,000 rows were read  
> in.  Did
> R run out of memory?  If so, is there a work around?
>
> You probably have mismatched quotes. Consider using quote="". Also  
> consider doing this:
>
> table(count.fields(file-name)) # with a valid file name
>
> That count.fields function is very useful since it accepts the same  
> arguments as the read.tables functions, with defaults of:
>
>  quote = "\"'", skip = 0, blank.lines.skip = TRUE, comment.char = "#")
>
> -- 
> David.
>
> Thanks,
> Mike
>
> On Fri, Jul 6, 2012 at 1:24 PM, Duncan Murdoch <murdoch.duncan at gmail.com 
> >wrote:
>
> On 06/07/2012 1:11 PM, C W wrote:
>
> Hi all
> I have a large SAS data set, how do I get it read in R?
>
> The data is too big (about 400,000 rows by 100 columns) to be saved  
> as an
> Excel file.  How should I get it read in R?  Any packages?  I don't  
> seem
> to
> find any.
>
>
> You could write it out in some plain delimited format, e.g. CSV or
> tab-delimited.  Watch out for special characters in strings that  
> confuse R
> when it reads it in (e.g. commas in unquoted CSV strings, quotes  
> within
> strings, etc.)
>
> Duncan Murdoch
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>
> David Winsemius, MD
> West Hartford, CT
>
>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list