Friday, November 10, 2017

Two handy helper for Windows user

# get Window path
ss_getwinpath <- function(aPath = "clipboard") {
y <- if (aPath == "clipboard") {
readClipboard()
} else {
cat("Please enter the path:\n\n")
readline()
}

x <- chartr("\\", "/", y)
writeClipboard(x)

return(x)
}

# send object to clipboard for excel
ss_send2excel <- function(aObj) {
write.table(aObj, file="clipboard-16384", sep="\t", row.names=FALSE, col.names=TRUE)
}


Put here: C:\Program Files\R\R-3.4.2\library\base\R\Rprofile
detail for configuration: https://getpocket.com/a/read/717423088

No comments:

Post a Comment