Hello everyone. How do I get R to ask users for data to be entered? Specifically I want to ask for a z score to be entered (the user would look this up in a table) and then use the entered data to compute a Dunn's post-hoc test (post kruskal.test). I've tried the "ask" function but it's not recognised - maybe I don't have to appropriate libary installed. A pointer to the right one would be appreciated. e.g >z <-ask(message="Please enter the z value for" x) Any help would be gratefully received. Thanks Iain Gallagher Institiute for Infection and Immunology Research Edinburgh University
Dear Iain, There's an ask() function in the sm package that does what you want, but you'll have to compose your message properly: ask(paste("Please enter the z value for", x)) Alternatively, eval(parse(text=readline(paste("Please enter the z value for ", x, ": ", sep="")))) will do what you want, as would as.numeric(readline(paste("Please enter the z value for ", x, ": ", sep=""))). I hope this helps, John -------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox --------------------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Iain Gallagher > Sent: Sunday, October 16, 2005 7:34 AM > To: r-help at stat.math.ethz.ch > Subject: [R] asking the user for data > > Hello everyone. > > How do I get R to ask users for data to be entered? > Specifically I want to ask for a z score to be entered (the > user would look this up in a > table) and then use the entered data to compute a Dunn's > post-hoc test (post kruskal.test). > > I've tried the "ask" function but it's not recognised - maybe > I don't have to appropriate libary installed. A pointer to > the right one would be appreciated. > > e.g >z <-ask(message="Please enter the z value for" x) > > Any help would be gratefully received. > > Thanks > > Iain Gallagher > Institiute for Infection and Immunology Research Edinburgh University > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
library(sm) > z <- ask(message="Please enter the z value for") Please enter the z value for: 1.96 > z [1] 1.96 I found this using RSiteSearch("ask", restrict="functions") . Iain Gallagher wrote:> Hello everyone. > > How do I get R to ask users for data to be entered? Specifically I want > to ask for a z score to be entered (the user would look this up in a > table) and then use the entered data to compute a Dunn's post-hoc test > (post kruskal.test). > > I've tried the "ask" function but it's not recognised - maybe I don't > have to appropriate libary installed. A pointer to the right one would > be appreciated. > > e.g >z <-ask(message="Please enter the z value for" x) > > Any help would be gratefully received. > > Thanks > > Iain Gallagher > Institiute for Infection and Immunology Research > Edinburgh University > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894
Use readline for a text dialog or use tkentry from the tcltk package as shown in the Edit Box example at: http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ On Windows other possibilities exist as well: winDialogString and in package svDialog there is guiDlg . Also check out qnorm . On 10/16/05, Iain Gallagher <iaingallagher at btopenworld.com> wrote:> Hello everyone. > > How do I get R to ask users for data to be entered? Specifically I want > to ask for a z score to be entered (the user would look this up in a > table) and then use the entered data to compute a Dunn's post-hoc test > (post kruskal.test). > > I've tried the "ask" function but it's not recognised - maybe I don't > have to appropriate libary installed. A pointer to the right one would > be appreciated. > > e.g >z <-ask(message="Please enter the z value for" x) > > Any help would be gratefully received. > > Thanks > > Iain Gallagher > Institiute for Infection and Immunology Research > Edinburgh University > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >