extrobe
9/6/2017 - 9:35 PM

FUNCTION: Copy data to Clipboard for Excel

Function for copying a dataframe to the clipboard to all you to paste it into excel

#function that copies a dataframe to the clipboard such that it can then be pasted to Excel (tab delimited)
cb <- function(df, sep="\t", dec=".", max.size=(200*1000)){
    # Copy a data.frame to clipboard
    write.table(df, paste0("clipboard-", formatC(max.size, format="f", digits=0)), sep=sep, row.names=FALSE, dec=dec)
}

cb(dataframe)
library(data.table)  
files <- list.files(path = "/etc/dump",pattern = ".csv")
temp <- lapply(files, fread, sep=",")
data <- rbindlist( temp )