My function is:
create_matrix <- function() {
cat("Write the numbers of vertices: ")
user_input <- readLines("stdin", n=1)
user_input <- as.numeric(user_input)
print(user_input)
}
With the version 3.5.0, after i entered the data the program doesn't continue the execution. I'm calling the script directly from the console.
readLines() function in R Language reads text lines from an input file. The readLines() function is perfect for text files since it reads the text line by line and creates character objects for each of the lines.
readLines [reader Package]
readlines() is used to read all the lines at a single go and then return them as each line a string element in a list. This function can be used for small files, as it reads the whole file content to the memory, then split it into separate lines.
By using R's pipe() command, and using shell commands to extract what we want, the full file is never loaded into R, and is read in line by line. It is this command that does all the work; it extracts one line from the desired file.
My findings using various docker images:
R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
from rocker/r-ver:3.4.4
.R version 3.5.0 (2018-04-23) -- "Joy in Playing"
from rocker/r-ver:3.5.0
.R Under development (unstable) (2018-05-19 r74746) -- "Unsuffered Consequences"
from rocker/drd
.It looks as if the change mentioned in the release notes for version 3.5.1 is unrelated. I have sent my findings to r-devel and will report back the outcome:
R version 3.5.1 (2018-07-02) -- "Feather Spray"
The bug has been marked as fixed. I can assert that version R Under development (unstable) (2018-06-02 r74838) -- "Unsuffered Consequences"
works as expected.
This is considered a bug, but it's unclear how and when it will be fixed.
A reasonable workaround: Send end-of-file (EOF, Ctrl-D) in addition to end-of-line.
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