Skip to content

Instantly share code, notes, and snippets.

@aaronwolen
Created January 11, 2013 20:11
Show Gist options
  • Save aaronwolen/4513600 to your computer and use it in GitHub Desktop.
Save aaronwolen/4513600 to your computer and use it in GitHub Desktop.
Paste directly to Mac clipboard
clipboard <- function(x, sep.lines = FALSE){
clipboard <- pipe('pbcopy', 'w')
if(sep.lines){
x <- unlist(strsplit(as.character(x), split = ","))
x <- sub(" ", "", x)
}
write.table(x, clipboard, sep = "\t",
quote = FALSE, col.names = FALSE, row.names = FALSE)
close(clipboard)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment