write_clip | R Documentation |
Write a character vector to the system clipboard
write_clip( content, object_type = c("auto", "character", "table"), breaks = NULL, eos = NULL, return_new = FALSE, allow_non_interactive = Sys.getenv("CLIPR_ALLOW", interactive()), ... )
content |
An object to be written to the system clipboard. |
object_type |
|
breaks |
The separator to be used between each element of the character
vector being written. |
eos |
The terminator to be written after each string, followed by an
ASCII |
return_new |
If true, returns the rendered string; if false, returns the original object |
allow_non_interactive |
By default, clipr will throw an error if run in
a non-interactive session. Set the environment variable
|
... |
Custom options to be passed to |
Invisibly returns the original object
On X11 systems, write_clip()
will cause either xclip (preferred) or
xsel to be called. Be aware that, by design, these processes will fork into
the background. They will run until the next paste event, when they will
then exit silently. (See the man pages for
xclip and
xsel
for more on their behaviors.) However, this means that even if you
terminate your R session after running write_clip()
, those processes will
continue until you access the clipboard via another program. This may be
expected behavior for interactive use, but is generally undesirable for
non-interactive use. For this reason you must not run write_clip()
on
CRAN, as the nature of xsel has caused issues in the past.
Call clipr_available()
to safely check whether the clipboard is readable
and writable.
## Not run: text <- "Write to clipboard" write_clip(text) multiline <- c("Write", "to", "clipboard") write_clip(multiline) # Write # to # clipboard write_clip(multiline, breaks = ",") # write,to,clipboard tbl <- data.frame(a=c(1,2,3), b=c(4,5,6)) write_clip(tbl) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.