0

Unable to generate reprex on Linux. When I try a simple example

  (y <- 1:4)
  mean(y)

I get the following message

No input provided and clipboard is not available.
Rendering reprex...
Clipboard on X11 requires 'xclip' (recommended) or 'xsel'.
Unable to put result on the clipboard. How to get it:
* Capture what `reprex()` returns.
* Consult the output file. Control via `outfile` argument.
Path to `outfile`:
    * /tmp/RtmpRYA93G/reprex16f2e48b49ed7/reprex_reprex.md
Open the output file for manual copy?
1: yes
2: no

and the following output in my viewer

 No user-supplied code found … so we’ve made some up. You’re welcome!

 sprintf("Happy %s!", weekdays(Sys.Date()))
 #> [1] "Happy Friday!"
 Created on 2020-10-16 by the reprex package (v0.3.0.9001)

Is it a clipboard issue on Linux? Thanks for helping out.

landrower
  • 475
  • 6
  • 11
  • 1
    From [the docs](https://reprex.tidyverse.org/) it does recommend having `xclip` or `xsel` installed on linux to access the clipboard. Have you installed those? Did you copy the code do your clipboard before running `reprex()` (that's where it assumed the input comes from). You can also not use your clipboard. For example `reprex::reprex({(y <- 1:4); mean(y)})` – MrFlick Oct 16 '20 at 03:33
  • `reprex::reprex({(y <- 1:4); mean(y)})` works. At this stage, I don't have the sudo access to install `xclip` or `xsel`, but will try it out again when I get those packs installed. Thank you MrFlick – landrower Oct 17 '20 at 00:59

1 Answers1

0

Clipboard is not generally available on Linux and users have to install xclip if they want to run reprex. An alternative is to not use the clipboard as suggested in MrFlick's comment

reprex::reprex({(y <- 1:4); mean(y)})
landrower
  • 475
  • 6
  • 11