One of the quickest ways in R to get data into it is to copy to the clipboard then paste it into a variable.
This can be done in Windows by
read.table("clipboard", header=T)
The exact same function can be done on a MAC computer with
read.table(pipe("pbpaste"), header=T)
However, in the MAC a red warning message appears like this
What seems to be happening is that R seems to read the clipboard with a missing closing line to the table. This also happens with files. Although the warning message does not seem to affect the data and can be ignored, it is annoying. So if you really want to see this message disappear, you can:
- copy the data from MS Excel
- paste into then copy the data from MS Word
- paste into R with
read.table(pipe("pbpaste"), header=T)
This seems to do the trick when nothing else seems to work. While this is not the most elegant and ideal solution, it is a solution. Enjoy.
Leave a Reply