Interfacing with user in R

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Interfacing with user in R

Augusto.Sanabria

Good day everyone,

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?
It is a simple exercise in other languages.
I am using R2.1.1 in a LINUX machine.

Thanks for your help.

Augusto

--------------------------------------------
Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk Research Group
Geospatial & Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av. & Hindmarsh Dr.
Symonston ACT 2609
Ph. (02) 6249-9155

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Interfacing with user in R

Simon Urbanek
On Jan 10, 2006, at 4:34 PM, <[hidden email]>  
<[hidden email]> 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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel