The Kmisc package has a bunch of clipboard functions, including write.cb()
, which will copy data to the clipboard. FYI, I’ve found sometimes it prints an error even when it’s working correctly.
I'm a big fan of RStudio and almost all their updates are for the better. But sometimes I need to copy-paste some information from a data table in the RStudio data viewer over to a spreadsheet, and with the new version of RStudio (Version 0.99.441, downloaded a few weeks ago, might still be in beta), it's now harder to do that. This is partly because of great new functionality that lets you sort and filter columns in your data table viewer while freezing column names. But I'd like to have my cake and eat it too, please. Has anyone discovered a hack? I could always write.csv()'s, but that's a little heavy handed for what I'm trying to do, even if it's technically not proper form to copy'n'paste from R.
--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.
I'm a big fan of RStudio and almost all their updates are for the better. But sometimes I need to copy-paste some information from a data table in the RStudio data viewer over to a spreadsheet, and with the new version of RStudio (Version 0.99.441, downloaded a few weeks ago, might still be in beta), it's now harder to do that. This is partly because of great new functionality that lets you sort and filter columns in your data table viewer while freezing column names. But I'd like to have my cake and eat it too, please. Has anyone discovered a hack? I could always write.csv()'s, but that's a little heavy handed for what I'm trying to do, even if it's technically not proper form to copy'n'paste from R.
--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.
--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.
<write-to-excel.pdf><write-to-excel.Rmd><write-to-excel.pdf><write-to-excel.Rmd>
read.cb()
and write.cb()
in the Kmisc package actually do pretty much exactly this, but detect your operating system. e.g.,
read.cb <- function(sep='\t', header=TRUE, ...) {
sn <- Sys.info()["sysname"]
if (sn == "Darwin") {
read.table( pipe("pbpaste"), header=header, sep=sep, ... )
} else if (sn == "Windows") {
read.table( "clipboard", header=header, sep=sep, ... )
} else {
stop("Reading from the clipboard is not implemented for your system (",
sn, ") in this package.")
}
}
cat.cb()
and scan.cb()
do the same thing for character data.