How to read input from the terminal using /dev/stdin and read.csv()?

落爺英雄遲暮 提交于 2019-12-01 23:17:23

I think the answer in the first link you posted may actually be applicable. R appears to create a 4 byte buffer on /dev/stdin. Also, as mentioned in the comment, you can use stdin instead, and it appears to work fine. (Although I still don't get why you have to hit Ctrl+D twice).

d <- read.csv(file='stdin', header=TRUE)
a,b
1,2
3,4
# Hit Control+D twice.
> d
  a b
1 1 2
2 3 4
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!