There’s some interesting stuff in this blog post about reading data into R, particularly about using
scan() to read data in (apparently you can use it to type data in, one entry per line).
That said, it’s a pain in the butt to depend on
scan()–most of the time when I’m pushing data around, I use R’s ability to read data frames from the clipboard.
I tend to use
read.csv(file='clipboard') more than
readClipboard(), mostly because I always forget about the latter.
One important note: by default, R only uses a small bit of the Windows clipboard to write files out (I have no idea how/if this works at all on Linux and Mac), something like 128KB. That’s not enough for a decent sized data frame/spreadsheet, but it’s pretty easy to bump that limit up.
If you do
write.table( foo, file = 'clipboard-4096'), just about anything should fit in there.
I’ve got a function named
write.clip() in my muadc R pacakge that does this for me, because I’m a lazy bum and got tired of typing “
sep = '\t', row.names = F“.