I want to use readLines function for input from console of variable number of lines and store it to a vector:
v <- readLines()
How do I signal the end of input? Control-c cancels the process and no 'v' object is formed. Control-Z stops R program altogether. Typing 'EOL' or 'EOF' do not work.
I tried following function but it gives error:
getinput = function(){
v=""
while(TRUE){
line = readLines(n=1)
if(line=="") break
v = v+line
}
v
}
> getinput()
firstentry
Error in v + line : non-numeric argument to binary operator
>
I am using R on Debian Linux. Thanks for your help.