clp <- function( header=FALSE, #whether the data contain the header row or not simplify=TRUE #whether to simplify the imported data ){ cdata <- read.table("clipboard", header=header, fill=TRUE) if(simplify) { if( (nrow(cdata)==1) || (ncol(cdata)==1) ) { cdata <- unlist(cdata, use.names=header) } else { cdata <- as.matrix(cdata) if(!header) { colnames(cdata) <- NULL } } } return(cdata) } comment(clp) <- c( "clp - Make a vector/matrix from the current clipboard.", "", "SYNOPSIS", " x <- clp()", "INPUT", " header : logical. TRUE to capture of a matrix which has a header row.", " simplify : logical. FALSE if you just want a data.frame constructed from the clipboard.", "OUTPUT", " x : a vector/matrix (or data.frame if simplify==FALSE).", "", "See http://www7b.biglobe.ne.jp/~homunculus/r/clp.html for detailed instruction in Japanese.", "ver.1.01, written by MOCHI, 2009." )