[R] littler: Use for batch processing of data sets: How to pass filename?

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Mon Dec 12 15:41:41 CET 2011


Why can't you just replace "temp/data" with filename (no quotes)? I'm not sure I get the question...

Michael

On Dec 12, 2011, at 5:26 AM, Paul Menzel <paulepanter at users.sourceforge.net> wrote:

> Dear R folks,
> 
> 
> I have several data sets I want to process automatically using R. I
> found littler [1] and thought this will do the trick.
> 
> 1. Read in data file to a data frame using `scan()`.
> 2. Do linear regression.
> 3. Write the data and the coefficients back to a file.
> 
>        #!/usr/bin/env r
> 
>        if (is.null(argv) | length(argv)!=1) {
> 
>          cat("Usage: auswertung.r datafile \n")
>          q()
> 
>        }
> 
>        filename <- as.character(argv[1])
> 
>        d = data.frame(x=scan("/tmp/data"))
>        write(sum(d$x), "/tmp/data.result", ncolumns=1)
> 
> Could someone help me how I can substitude `/tmp/data` with the value
> stored in `filename`? I do not get it to work using `do.Call` or
> `paste()`.
> 
> 
> Thanks,
> 
> Paul
> 
> 
> [1] http://code.google.com/p/littler/
> <data>
> <auswertung.r>
> ______________________________________________
> 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.



More information about the R-help mailing list