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 R to automatically finish scanning after the user has entered the 1st
character, without hitting 'enter'.
How do I do this?
Thanks
------------
KC
______________________________________________
[email protected] 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.