Dear all, I have a dataframe and I want to introduce a new column in it.but the value i want is from user.Like there should be a message to user "enter your number" and the number user will type should come in a new column in data frame for all rows.I tries scan,menu and read.line but i did not know how to do it. Can you please help me. Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London
On Jul 11, 2011, at 6:03 PM, Bansal, Vikas wrote:> Dear all, > > I have a dataframe and I want to introduce a new column in it.but > the value i want is from user.Like there should be a message to user > "enter your number" > and the number user will type should come in a new column in data > frame for all rows.I tries scan,menu and read.line but i did not > know how to do it.Learn to search more widely > ??"user input" > RSiteSearch("user input") A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly > require(sos) > findFn("user input") found 1721 matches; retrieving 20 pages, 400 matches. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20> > Can you please help me. > > > Thanking you, > Warm Regards > Vikas Bansal > Msc Bioinformatics > Kings College London > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT
try something like: cat("\n","Enter your number","\n") # prompt y<-scan(n=1) #scans the line before ? perhaps? -- View this message in context: http://r.789695.n4.nabble.com/user-input-tp3660993p3661031.html Sent from the R help mailing list archive at Nabble.com.
Please! help.search("prompt") ?readline -- Bert On Mon, Jul 11, 2011 at 3:33 PM, mousy0815 <mousy0815 at gmail.com> wrote:> try something like: > > > cat("\n","Enter your number","\n") # prompt > y<-scan(n=1) #scans the line before > > ? perhaps? > > > -- > View this message in context: http://r.789695.n4.nabble.com/user-input-tp3660993p3661031.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- "Men by nature long to get on to the ultimate truths, and will often be impatient with elementary studies or fight shy of them. If it were possible to reach the ultimate truths without the elementary studies usually prefixed to them, these would not be preparatory studies but superfluous diversions." -- Maimonides (1135-1204) Bert Gunter Genentech Nonclinical Biostatistics 467-7374