[Rd] Interfacing with user in R

Simon Urbanek simon.urbanek at r-project.org
Tue Jan 10 22:43:21 CET 2006


On Jan 10, 2006, at 4:34 PM, <Augusto.Sanabria at ga.gov.au>  
<Augusto.Sanabria at ga.gov.au> wrote:

> I am new in R programming (my question may sound trivial to you):  
> is there any way to ask the user to enter a string within an R  
> process, say a filename, make R to recognise it and open the given  
> file?

Sure, for reading you can use readLines. I have no idea what you mean  
by "recognise", but let's say if you wanted to use read.table, it  
would be
read.table(readLines(n=1))

Of course, in R there is an even more convenient method far that ;)
read.table(file.choose())

Cheers,
Simon



More information about the R-devel mailing list