[R] More on Win R and clipboard

Ursula Kellett u.kellett at qut.edu.au
Fri Mar 24 08:31:39 CET 2000


Many thanks to all those who replied about my clipboard query.

In response to conter-queries:

> Peter:
>Counterquestion: How would you expect it to work? What would
>you do with it once it was on the clipboard and how would
>you ensure that data contained the relevant information
>(factor levels, e.g.) when read from the clipboard? What are
>the relevant communication channels?

> Guido:
>What kind of functionality are you thinking about? Something like
>having 'read.table.from.clipboard' or something more advanced?


Well I guess I was thinking of something pretty basic, eg for the convenience
of transferring to/from EXCEL as Peter Bernat suggested. I use another great
freeware program called MACANOVA
(http://www.stat.umn.edu/~gary/macanova/macanova.home.html) and I find its
'toclip' and 'fromclip' functions _very_ handy. This was the kind of thing I
had in mind.

However after reading Zivan Karaman's post, I think he's hit the nail square
on the head. I couldn't put it any better so here are his ideas below again in
case you missed them.

Regards,
Ursula


>On 23 Mar 00, at 14:21, zivan.karaman at limagrain.com wrote:
>
> 
> The usual way of copying 2-dimensional arrays to and from the
> clipboard is to separate columns by <Tab> character, and to separate
> lines by <Newline> character (CR-LF under DOS/Windows).
> 
> Potential problems (at least the three I can see immediately):
> dimnames, factors and NAs.
> 
> I would suggest that including dimnames should be optional.
> 
> I would assume that factors should be copied as.character(...) TO
> clipboard. When pasting FROM the clipboard, it would be nice to have
> an option for leaving the character vectors as text or transforming
> them into factors. (I often have to do a lot of gymnastics to
> transform factors into character vectors in dataframes with S+, and I
> really don't like it).
> 
> The NAs could be represented by empty cell, i.e. <Tab><Tab>, for both
> copy and paste.
> 
> In S-PLUS 2000, one can copy and paste data from the data editor, but
> it seems that the dimnames don't get copied.
> 
> In fact, I think that the clipboard operations should work like
> read.table and write.table, except  that under R , 'file="clipboard" '
> apparently uses an internal clipboard, and not the standard Windows
> clipboard.
> 
> With S-PLUS 2000, if you say
> 
>      write.table(x,file="clipboard",sep="\t")
> 
> you can paste the data into Excel.
> 
> You can also read data from Excel by
> 
>      read.table(file="clipboard",header=T,sep="\t")
> 
> 
> Best regards
> 
> Zivan
> 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list