The title says it all: I have my data open in another application (e.g., a spreadsheet, like Excel, or a text editor). If I copy that data to my operating system clipboard, how can I read it into R as a data.frame?
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- What is the best way to do a search in a large fil
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
The name and exact connection used for the 'clipboard' varies depending on the OS.
for Windows:
for Mac OS:
This works because read.delim, like many functions, will accept a range of connection types beyond just a file. For Macs we're actually using a pipe.
help(connections)
is pretty informative.The psych package has a function
read.clipboard()
that makes this a little easier by testing for your OS.As noted by others here, you can also write to the clipboard. There is normally a 32 K limit, which can be raised by using adding a hyphen and number after clipboard as in, for example, passing up to 256 K worth of data from object df with:
I needed to copy a composite url into the Windows clipboard, while
read.table()
outputted a character vector with quotation marks around my URL. Instead, I usedwriteClipboard(URL,format=1)
from package utils, and it did the trick.