I have used pipe
to copy and paste data between Rstudio (v0.99.467) and Excel on my Mac OSX 10.9.5.
pipe(\"pbcopy\", \"w\")
pipe(\"pbpaste\")
On OSX Mojave using R 3.5.1, you can use the following block to capture the clipboard:
clipboard <- system("pbpaste", intern = T)
I can also confirm that the following block is working:
clipboard <- scan(pipe("pbpaste", "r"), what = character())
However, connections are sometimes tricky to work with. For example:
clipboard <- readLines(pipe("pbpaste", "r"))
Returns an empty character vector, likely because there's no newline terminator in the clipboard!