3
Motivation
In various language questionsR
I see people putting the contents of a table instead of showing the steps to reproduce the data they’re analyzing. Requests to provide the result of the command dput
are simply ignored.
Having to type something like
dados <- data.frame(carat = c(0.230, 0.210) ...)
at all times is tedious, subject to mistakes and a waste of time.
Question
How do I transfer the data from the table below to a data.frame
using the clipboard? The famous Ctr-v
carat cut color clarity depth table price x y z
0.230 Ideal E SI2 61.5 55.0 326 3.95 3.98 2.43
0.210 Premium E SI1 59.8 61.0 326 3.89 3.84 2.31
0.230 Good E VS1 56.9 65.0 327 4.05 4.07 2.31
0.290 Premium I VS2 62.4 58.0 334 4.20 4.23 2.63
0.310 Good J SI2 63.3 58.0 335 4.34 4.35 2.75
0.220 Fair E VS2 65.1 61.0 337 3.87 3.78 2.49
I just tested.
read.table(file = "clipboard", head = TRUE)
also works on linux.– Marcos Banik