Presumably, Rstudio redirects stdin, so it may not be properly accessible like "stdin"or "/dev/stdin". However, stdin()it still works.
I still could not type Ctrl + D. But you can read a fixed number of lines:
> a <- readLines(stdin(), n=2)
Hello
World
> a
[1] "Hello" "World"
, . , 10 .
> a <- readLines(stdin(), n=10)
abc
def
ghi
...
> a <- a[a != ""]
> a
[1] "abc" "def" "ghi"
, Ctrl + D, .
:, stdin() Rscript: file("stdin"). , , readLines n=1 , . , , . read.table - Rstudio.