Как написать в буфер обмена на Ubuntu / Linux в R?

Я использую Ubuntu 11.10, и я хотел бы иметь возможность записи в буфер обмена (или основной выбор). Следующее дает ошибку

> x <- 1:10
> dput(x, 'clipboard')
Error in file(file, "wt") : 'mode' for the clipboard must be 'r' on Unix

How can I write to the clipboard/primary selection?

Обратите внимание, что я виделэтот старый пост R-Help, но я до сих пор не понимаю, что мне делать.

Linux does not have a clipboard but an X11 session has primary and secondary selections. ?file says

Clipboard:

  'file' can also be used with 'description = "clipboard"' in mode
  '"r"' only.  It reads the X11 primary selection, which can also be
  specified as '"X11_primary"' and the secondary selection as
  '"X11_secondary"'.

  When the clipboard is opened for reading, the contents are
  immediately copied to internal storage in the connection.

  Unix users wishing to _write_ to the primary selection may be able
  to do so via 'xclip' (<URL:
  http://people.debian.org/~kims/xclip/>), for example by
  'pipe("xclip -i", "w")'.

so RTFM applied. Writing to an X11 selection needs multiple threads and I did not think it worth the very considerable effort of implementing (unlike for Windows).

Note that window managers may have other clipboards, and for example the RGtk2 package has interfaces to gtk clipboards.

Ответы на вопрос(4)

Ваш ответ на вопрос