#' import clipboard data
#'
#' @description This function imports data from the clipboard
#' @param header determines whether to include column names or not
#' @return datatframe, tibble
#' @keywords import
#' @import utils
#' @export
#' @examples df <- read.clipboard(header = TRUE)
read.clipboard <- function(header = TRUE,...) {
MAC<-Sys.info()[1]=="Darwin" #are we on a Mac using the Darwin system?
if (!MAC ) {if (header) read.clipboard<-read.table(file("clipboard"),header=TRUE,...)
else read.clipboard<-read.table(file("clipboard"),...) }
else {
if (header) read.clipboard<- read.table(pipe("pbpaste"),header=TRUE,...)
else read.clipboard<- read.table(pipe("pbpaste"),...)}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.