title: Why read.clipboard is not working in R
body: <p>Why is read.clipboard() not working on my system? </p>
  
  <pre><code>&gt; library(psych)
  &gt; read.table(text=read.clipboard(), sep="\t", header=T, stringsAsFactors=F, strip.white=T)  
  Error in textConnection(text, encoding = "UTF-8") : 
    invalid 'text' argument
  In addition: Warning message:
  In read.table(file("clipboard"), header = TRUE, ...) :
    incomplete final line found by readTableHeader on 'clipboard'
  
  
  &gt; read.table(text=readClipboard(), sep="\t", header=T, stringsAsFactors=F, strip.white=T)  
  Error in textConnection(text, encoding = "UTF-8") : 
    could not find function "readClipboard"
  </code></pre>
  
  <p>The version information: </p>
  
  <pre><code>&gt; packageVersion('psych')
  [1] ‘1.4.8.11’
  
  
  &gt; R.version
                 _                           
  platform       i486-pc-linux-gnu           
  arch           i486                        
  os             linux-gnu                   
  system         i486, linux-gnu             
  status                                     
  major          3                           
  minor          1.1                         
  year           2014                        
  month          07                          
  day            10                          
  svn rev        66115                       
  language       R                           
  version.string R version 3.1.1 (2014-07-10)
  nickname       Sock it to Me               
  &gt; 
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>As suggested by @RichardScriven, I used following:</p>
  
  <pre><code>read.table('clipboard', sep="\t", header=T)  
  </code></pre>
  
  <p>If I copy some cells in a spreadsheet and try above command, it does not work. Following is the error:</p>
  
  <pre><code>Error in file(file, "rt") : cannot open the connection
  In addition: Warning message:
  In file(file, "rt") : clipboard cannot be opened or contains no text
  </code></pre>
  
  <p>But if I paste first to a text editor, and copy it again from there, then the above command works well. </p>
  
  <p>How can I directly use the data after copying from a spreadsheet? </p>
  
  <p>Following command also shows same problem, works when copied from text editor but not when copied from spreadsheet. I produces same error.  </p>
  
  <pre><code>&gt; read.clipboard(sep="\t", header=T)  
  Error in open.connection(file, "rt") : cannot open the connection
  In addition: Warning message:
  In open.connection(file, "rt") :
    clipboard cannot be opened or contains no text
  </code></pre>