4
One of the advantages of using spreadsheet is that we can import data from the Clipboard.
Is there any way to do it in R?
4
One of the advantages of using spreadsheet is that we can import data from the Clipboard.
Is there any way to do it in R?
3
Yes, it is possible. But there are differences in Windows and Mac:
On Windows:
You can use the function readClipboard()
.
x <- readClipboard()
This will paste the Clipboard data as text in x. If the Clipboard data is tabular (a table, for example), you can use the function read.table()
x <- read.table(file = "clipboard", sep = "\t")
On the Mac:
On Mac, you will use the function pipe
along with read.table
.
x <- read.table(pipe("pbpaste"), sep="\t")
Browser other questions tagged r
You are not signed in. Login or sign up in order to post.
How it’s done on Linux?
– Guilherme Duarte
@Guilhermed, I’m not running a Linux test right now, but I don’t think it’s much different. Anyway, feel free to put a complementary answer with the solution for Linux if you test and find out the correct answer.
– Carlos Cinelli
I just tested it. A simple
x <- read.table("clipboard")
solves the problem, hug.– Guilherme Duarte