[R] SAS "datalines" or "cards" statement equivalent in R?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Mon Dec 7 18:45:36 CET 2009


On Mon, Dec 7, 2009 at 5:37 PM, Marshall Feldman <marsh at uri.edu> wrote:
> I totally agree with Barry, although it's sometimes convenient to include
> data with analysis code for debugging and/or documentation purposes.
>
> However, the example actually applies equally to separate data files. In
> fact, the example is from the U.S. Bureau of Labor Statistics at
> ftp://ftp.bls.gov/pub/time.series/sm/, which contains nothing but data and
> documentation files. At issue is not where the data come from, but rather
> how to parse relatively complex data organized inconsistently. SAS has
> built-in the ability to parse five different organizations of data: list
> (delimited), modified list, column, formatted, and mixed (see
> http://www.masil.org/sas/input.html). It seems R can parse such data, but
> only with considerable work by the user. It would be great to have a
> function/package that implements something with as easy (hah!) and flexible
> as SAS.

 I'd love to duplicate this functionality of SAS, however, I fear:

http://www.sas.com/news/preleases/SASsuit.html

 but yes, some kind of declarative, template-driven data definition
system might be useful. Such a thing may already exist, and be based
on XML instead of what looks like line noise:

INPUT #1 No 7.0 #2 name $CHAR15. / address $CHAR50. #4 phone $CHAR12.;

Barry




More information about the R-help mailing list