dump_to_clip: Dump objects to clipboard (to transfer them between R...

dump_to_clipR Documentation

Dump objects to clipboard (to transfer them between R sessions)

Description

This function calls dump on one or several R objects, which creates code that recreates them from the console. It then copies this code to the clipboard. This can be used to quickly copy (small) objects between R sessions, for instance during package development and testing, or - of course - to paste the dump code into a forum post.

Usage

dump_to_clip(x)

Arguments

x

An object to dump to the clipboard, or a character vector of object names. To enable the use in pipelines, objects that are passed directly will be named dumped_object in the resulting code.

Examples

if (interactive()) {
  outcome <- "mpg"
  mod <- lm(mpg ~ wt, mtcars)
  mod %>% dump_to_clip() # will be named dumped_object
  dump_to_clip(c("outcome", "mod")) # will retain variable names
}


LukasWallrich/timesaveR documentation built on Nov. 29, 2024, 4:47 a.m.