Because of the work I do with R, I need to use the readline()
function to enter text. The problem comes when sometimes, instead of writting readline()
I run readLines()
accidentally (due to autocomplete or whatever reason).
Once I have run readLines()
, there is nothing I can do to escape the function. I can keep on writing but can't recover a prompt in the console (can't run any code) as I do not know how to close the readLines()
function call. Any clues?
Note that this problem only happens in RStudio (and, according to Matt in the comments, Visual Studio).
Not a perfect fix, but you can use debug()
. Anytime you do end up calling readLines()
by accident, you can just exit browse[2]
by typing Q
.
debug(readLines)
readline()
asdf
[1] "asdf"
readLines()
debugging in: readLines()
debug: {
if (is.character(con)) {
con <- file(con, "r")
on.exit(close(con))
}
.Internal(readLines(con, n, ok, warn, encoding, skipNul))
}
Browse[2]> Q
readline()
asdf
[1] "asdf"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With