I am experimenting with reading input from a user in R. So I am running a simple piece of code:
input <- readLines("stdin", n = 2)
I am expecting to give two lines of input to the console and then I would assume that the connection will close. I am trying to figure out how to give the correct input.
I have tried including \n in my input but is not helping. I know that this question has been asked before here : R readLines from console- how to signal end of input but I did not find the answer to be useful. I get stack with a non-ending connection which I cannot stop by using CTRL-Z , CTRL-D or any other control combination for that matter.
Could someone please explain how to correctly give input to the function, specify EOL, EOF and perhaps the expected format?