[R-SIG-Mac] Clipboard problems

Duncan Murdoch murdoch.duncan at gmail.com
Wed Sep 3 13:56:33 CEST 2014


The standard advice for reading the clipboard on OSX is to use the
pipe("pbpaste") connection, but I'm finding it misses the last line.  (I
believe the last line in my examples generally doesn't include any EOL
marker.)  For example, if I highlight these three lines:

line 1
line 2
line 3

and copy to the clipboard, then readLines(pipe("pbpaste")) gives

[1] "line 1" "line 2"

in R.app or R in a terminal.  If I paste them here, I get

line 1
line 2
line 3

with the cursor left on the third line after the 3.  In a console, echo
`pbpaste` gives

line 1 line 2 line 3

so the problem isn't (only) with pbpaste.

Duncan Murdoch



More information about the R-SIG-Mac mailing list