[R] littler: Use for batch processing of data sets: How to pass filename?
Paul Menzel
paulepanter at users.sourceforge.net
Mon Dec 12 11:26:33 CET 2011
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/
-------------- next part --------------
1
2
3
4
-------------- next part --------------
#!/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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111212/3bbae841/attachment.bin>
More information about the R-help
mailing list