Friday, October 16, 2015

Read table from clipboard into R

This awesome function is from the psych package.

read.clipboard              package:psych              R Documentation

shortcut for reading from the clipboard


     Input from the clipboard is easy but a bit obscure, particularly
     for Mac users. This is just an easier way to do so.  Data may be
     copied to the clipboard from Exel spreadsheets, csv files, or
     fixed width formatted files and then into a data.frame. Data may
     also be read from lower (or upper) triangular matrices and filled
     out to square matrices.


     read.clipboard(header = TRUE, ...)   #assumes headers and tab or space delimited
     read.clipboard.csv(header=TRUE,sep=',',...)   #assumes headers and comma delimited,sep='\t',...)   #assumes headers and tab delimited
      #read in a matrix given the lower off diagonal