[R] Fwd: source('clipboard')

Duncan Murdoch murdoch at stats.uwo.ca
Mon Dec 3 19:51:00 CET 2007


On 12/3/2007 1:31 PM, Fernando Saldanha wrote:
> In the code below the first source command works fine, but the second
> does not, as can be seen from the error message. Is there a way to
> have the second command work?
> 
> I am using R 2.6.1 on Windows Vista.
> 
> (The command that is in the clipboard is just "x <- 3")
> 
>> source("clipboard", echo = F)
>> source("clipboard", echo = T)
> Error in file(srcfile$filename, open = "rt", encoding = srcfile$encoding) :
>   'mode' for the clipboard must be 'r' or 'w'
>>
> 
> Thanks for the help.

That looks like a little bug.  I'll fix it in a day or two, but in the 
meantime you can work around it with code like this (which you'd 
probably want to put in a function, not type all the time yourself):

f <- file("clipboard", open="r")
source(f, echo=T)
close(f)

Duncan Murdoch



More information about the R-help mailing list