Zbynek
Zbynek

Reputation: 5945

R: cat data to buffer instead to console screen

I would like to cat data to buffer, so I can copy them using CTRL + V command. Now they get prinded to screen, from which I have to copy them manually. I know how to print to file in R, but it is not suitable for my purposes.

Upvotes: 0

Views: 497

Answers (1)

nicola
nicola

Reputation: 24480

The way, as indicated in this SO question and reported by @etienne, is to use the linux utility xclip. The clipr package wraps it and make it easy to use. It provides the intuitive read_clip and write_clip functions. For instance, you can try:

require(clipr)
write_clip(letters[1:10],breaks="")

and write:

abcdefghij

with CTRL+V.

Important notice: you can install clipr without xclip, but it will be basically useless.

Upvotes: 2

Related Questions