From dmurdoch at pair.com  Sat Nov  8 16:40:54 2003
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Sat Nov  8 16:40:41 2003
Subject: [Rd] accessing windows clipboard from load and save (PR#4999)
In-Reply-To: <20031108142148.AB6D1F4FD@slim.kubism.ku.dk>
References: <20031108142148.AB6D1F4FD@slim.kubism.ku.dk>
Message-ID: <3s2qqv8oa86pn0ltgd7sufqvlep8copa2f@4ax.com>

On Sat,  8 Nov 2003 15:21:48 +0100 (CET), you wrote:

>Full_Name: Gabor Grothendieck
>Version: 1.7.1
>OS: Windows 2000
>Submission from: (NULL) (207.35.143.81)
>
>
>
>   save(x,ascii=TRUE,file("clipboard")) 
>
>works but 
>
>   load(file("clipboard")) 
>
>does not.

This is a documented limitation of the clipboard connection (which is
write-only), not a bug.  Yes, it would be nice if all clipboard
functions were supported, but they're not.  

>Even better would be if
>
>   save(x,ascii=TRUE,"clipboard") 
>and 
>   load("clipboard")
>
>worked as that would provide consistency with read.table("clipboard")

Is this documented somewhere?  I didn't know about it (but it does
work).

Personally, I'd rather have a connection created by a function named
clipboard(); it looks kludgy to interpret some filenames as magic
values.  Then your examples would be

save(x,ascii=TRUE,file=clipboard('w')) 

load(clipboard())

read.table(clipboard())

Another special connection (which might exist? I couldn't spot it)
would be one that read from a character vector, i.e. c('a','b','c')
would be read as 3 lines of one letter each.  Then something like

 stringConnection(readClipboard()) 

would be one way to implement clipboard().

Duncan Murdoch


[Rd] accessing windows clipboard from load and save (PR#4999)
Duncan Murdoch