Reputation: 3812
I'm trying to implement a simple selection using the console. This is the code:
n <- readline(prompt = "1 - selection A\n2 - selection B\nInput: ")
And the whole thing is working, but the input is written at the end of the first line, after 'selection A'. I'd like the user input to be at the end of the prompt (after 'Input: '). Thanks!
Upvotes: 2
Views: 1895
Reputation: 382
As Roman has rightly pointed out, your code should work in RGui. In Rstudio, I would use
cat("1 - selection A\n2 - selection B\n")
n<-readline(prompt ="Input: ")
Upvotes: 4