I'm new to R, I wonder how to input EOF in stdin f开发者_C百科or R ? For example, the function readLines() reads input lines from stdin, but how can tell it to stop ?
A rookie problem, and thanks for you attention.
PS. Problem solved. But I still cannot input EOF in the StatET (R plugin for eclipse). Any one has any solution ?
The input is handled by the readline
library common to other GNU project programs, and it commonly receives EOF when you press Ctrl-D.
Here is an example using littler (and I am not sure why every inout gets echoed back):
$ r -e 'print(summary(as.integer(readLines())))'
1
1
2
2
3
3
4
4
8
8 ## I pressed Ctrl-D here
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.0 2.0 3.0 3.6 4.0 8.0
$
精彩评论