Skip to content
Prev 2392 / 398506 Next

character vector as input to function?

I would like to have a function that inputs a file name, then reads that
data file and does various stuff to it.
Something like:

doit<-function(filename)        
{
x<-scan("~/rstuff/data/"filename)
#for example, if filename is a0.dat, it will scan("~/rstuff/data/a0.dat")  
...
}

Can someone please tell me how to do this?

Thanks for any help!

Bill Simpson

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._