ggrothendieck@myway.com
2003-Nov-08 15:20 UTC
[Rd] accessing windows clipboard from load and save (PR#4999)
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. Even better would be if save(x,ascii=TRUE,"clipboard") and load("clipboard") worked as that would provide consistency with read.table("clipboard")
Duncan Murdoch
2003-Nov-08 16:40 UTC
[Rd] accessing windows clipboard from load and save (PR#4999)
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
Prof Brian Ripley
2003-Nov-08 16:46 UTC
[Rd] accessing windows clipboard from load and save (PR#4999)
Yet another report of a non-bug! First, your example of the use of save() does not work. That *is* a bug. Second, please RTFM. help(load) says 'load' can load R objects saved in the current or any earlier format. It can read a compressed file (see 'save') directly from a file or from a suitable connection. ^^^^^^^^ and nothing says a clipboard is a suitable connection. If you really want to make a positive contribution you could work out what changes are necessary to make a clipboard a suitable connection and supply a patch against the current sources (not an obselete version of R). Hints: load expects to be able to open a connection in binary mode, and to wrap it in a decompression wrapper. On Sat, 8 Nov 2003 ggrothendieck@myway.com 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. > > Even better would be if > > save(x,ascii=TRUE,"clipboard") > and > load("clipboard") > > worked as that would provide consistency with read.table("clipboard") > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Gabor Grothendieck
2003-Nov-08 17:24 UTC
[Rd] accessing windows clipboard from load and save (PR#4999)
The bug list is the only place to record and track suggestions. I don't think it matters whether its a bug in the strict sense of the word. The clipboard should work consistently and orthogonally across R. Perhaps there could be a categorization of issues submitted to the bug list to properly identify which are bugs in the narrow sense, which are inconsistencies, which are feature enhancement suggestions, etc. --- On Sat 11/08, Prof Brian Ripley < ripley@stats.ox.ac.uk > wrote: Yet another report of a non-bug!
Gabor Grothendieck
2003-Nov-08 17:54 UTC
[Rd] accessing windows clipboard from load and save (PR#4999)
I agree that that would be a cleaner solution. --- On Sat 11/08, Duncan Murdoch < dmurdoch@pair.com > wrote: Personally, I'd rather have a connection created by a function named clipboard(); it looks kludgy to interpret some filenames as magic values.
Gabor Grothendieck
2003-Nov-08 18:16 UTC
[Rd] accessing windows clipboard from load and save (PR#4999)
Regarding, loading a file from the clipboard, I had also posted a workaround: load(pipe("pclip")) where pclip is from unxutils.sourceforge.net, although yours has the advantage of not requiring external programs. --- On Sat 11/08, Prof Brian Ripley < ripley@stats.ox.ac.uk > wrote: zz <- file("clipboard", "r") readLines(zz, 1) .Internal(loadFromConn(zz, .GlobalEnv)) close(zz)