Table of Contents

R read data from clipboard for Windows and Mac

On Mac

On Mac Os X, the function pipe can be used to read and copy to clipboard. I often copy data from excel to clipboard and then read them into R. Specifically, the following code can be used.

dset <- read.table(pipe("pbpaste"), sep="\t")

On Windows

On Windows OS, the following can be used

x <- read.table(file = "clipboard", sep = "\t")