Rstudio: Cmd + C/V not working in editor

前端 未结 1 1446
猫巷女王i
猫巷女王i 2021-02-19 16:17

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\")
         


        
1条回答
  •  遇见更好的自我
    2021-02-19 16:29

    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!

    0 讨论(0)
提交回复
热议问题