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/
1
2
3
4
#!/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)

Attachment: signature.asc
Description: This is a digitally signed message part

______________________________________________
[email protected] 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.

Reply via email to