Re: [R] Getting user input without hitting enter

2010-11-24 Thread Kohleth Chia
elp-boun...@r-project.org [mailto:r-help-boun...@r- >> project.org] On Behalf Of Kohleth Chia >> Sent: Wednesday, November 24, 2010 5:53 AM >> To: r-help@r-project.org >> Subject: [R] Getting user input without hitting enter >> >> Hi, >> >> I am writin

Re: [R] Getting user input without hitting enter

2010-11-24 Thread Greg Snow
Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Kohleth Chia > Sent: Wednesday, November 24, 2010 5:53 AM > To: r-help@r-project.org > Subject: [R] Getting user input wit

[R] Getting user input without hitting enter

2010-11-24 Thread Kohleth Chia
Hi, I am writing a function which requires user to enter a single character. Something like: hello<-function(){ input<-scan(n=1,what="a") if(input=="h")cat("Hello") # What goes after the 'if' is completely arbitrary, for simplicity sake I simply put a cat command here. } I want