[R] raw input prompt

Bert Gunter gunter.berton at gene.com
Sat Jun 2 22:01:18 CEST 2012


... or

On Sat, Jun 2, 2012 at 11:29 AM, J Toll <jctoll at gmail.com> wrote:
> On Fri, Jun 1, 2012 at 1:01 PM, meatloafthefrog
> <meatloafthefrog at gmail.com> wrote:
>> I want a prompt that asks the user for the file name of the table,
>> the response to which will be the name of the table in R.
>>
>> So I did something like:
>>
>> file_name = function()                                         #This
>> function, when called up, prompts the user to enter the file name.
>> {
>> readline("Enter name of csv file: ")
>> }
>> filename = file_name()
>
> For what you're trying to do, consider simplifying to:
>
> filename <- readline(file.choose())
>
> HTH
>
> James
>

or even simpler, do it all in one go:

mydata <- read.csv(file.choose() )

-- Bert

> ______________________________________________
> R-help at r-project.org 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list