R/read.clipboard.R

Defines functions read.clipboard

#' 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"),...)}
}
europace-privatkredit/tidyPkuData documentation built on Oct. 2, 2019, 3 a.m.