Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions reproduce.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,14 @@ reproduce <- function(x, rows=10, head=NA, cols=NA, clipboard=TRUE, whole=FALSE,
ret <- gsub(pattern, "", ret)

# if on Mac OSX and flagged to true, then copy to clipboard
if(clipboard && Sys.info()[['sysname']] == "Darwin") {
con <- pipe("pbcopy", "w")
writeLines(ret, con)
close(con)
if(clipboard){
if(Sys.info()[['sysname']] == "Darwin") {
con <- pipe("pbcopy", "w")
writeLines(ret, con)
close(con)
}
else if(Sys.info()[['sysname']] == "Windows")
writeLines(ret,'clipboard')
}

if (verbose) {
Expand All @@ -269,7 +273,7 @@ reproduce <- function(x, rows=10, head=NA, cols=NA, clipboard=TRUE, whole=FALSE,
ln <- function() cat(" ==X", rep("=", 62), "X==\n", sep="")
ln()
cat({if (clipboard) "" else rep(" ", 18)}, sep="")
cat(" Copy+Paste this part.", ifelse(clipboard, "(If on a Mac, it is already copied!)\n", "\n"))
cat(" Copy+Paste this part.", ifelse(clipboard, "(If on a Mac or Windows, it is already copied!)\n", "\n"))
ln()
cat("\n", ret, "\n\n")
ln()
Expand Down