Why isn't readClipboard() working?

Hello,

So I'm trying to do something really simple. In a separate tab, I have open wordcounter.net, and I have printed the word "Test" without the quotation marks. I am trying to copy that and paste it into R and save it as a character object using the readClipboard command from the utils package.

What's puzzling me is that despite the utils package being installed (I'm pretty sure it's default as in it comes with R/Rstudio when you download it). Just to be sure though, despite seeing a checkmark next to it under my packages, I did the library(utils) command and tried this:

myobject <- utils::readClipboard()

and I got back as an error: Error in readClipboard() : could not find function "readClipboard"

I'm just puzzled and don't know what to do because I have the utils package installed. I've used this command for work stuff, so I'm hoping one of you kind souls can help me.

In case it matters, I'm on a 2019 macbook pro on OS High Sierra with R version 4.0.2 (I know, I need to update it haha).

Thanks!

Do you need to do

library(utils)

?

1 Like

readClipboard is only for Windows

Ooooh, well, that would do it. I do have a windows computer for work. Damn, haha, at least I know now. Thanks!

See if the package {clipr} helps.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.