jose romero
2010-Feb-10 16:05 UTC
[R] getting input from the console when running R in batch mode
Hello list: I am using R through Geany in Ubuntu. The way i have Geany configured is that upon invoking the exectute command, Geany does a "R <myscript.R >myscript.out", thus getting all input from the myscript.R file and redirecting all output to the myscript.out file. This is a problem when I want to read, say a numeric value, from the keyboard, or when i'd like to output something to the console: num <- scan(stdin(),what=numeric(1),lines=1) Iin this case R ignores the stdin() connection (which should be a terminal class). Is there an easy way around this problem, other than reading my data from a file or using the tcltk library? All i'd like to do is just read values from the terminal/console. Thanks in advance, jose romero [[alternative HTML version deleted]]