This is only guaranteed for Windows; in the case of Linux you will
need to have the xclip
command installed and visible on the PATH
and for Mac OS you will need to have pbcopy
similarly available.
In any case the transfer to the clipboard is only activated while in
an interactive session.
copy_to_clipboard(x, ..., file = con)
a characeter string vector
additional arguments as for cat
a file or connection (usually left at the default)
x
, invisibly (as for a print method)
It behaves like base::cat
but differs in three respects.
First, if file
is left missing, in an interactive session,
the default file is a clipboard device, if possible.
Second, the return value is invisible(x)
rather than
invisible(NULL)
as it is for base::cat
.
Third, it only has a copying side-effect if used in an interactive session.
In a non-interactive session it merely returns the x
argument, invisibly.
Note the on Windows
the function utils::writeClipboard
offers
a much more extensive range of possibilities for communicating with the
clipboard device, but this facility is only available on Windows
.