clippy: Copy a dataframe, vector, or the result of an expression to...

View source: R/interactive_programming.R

clippyR Documentation

Copy a dataframe, vector, or the result of an expression to the clipboard

Description

Tested on Windows.

Usage

clippy(x = NULL)

Arguments

x

(An expression, vector, dataframe, or NULL) The thing to copy to the clipboard. If NULL, the .Last.value will be copied. If x is a dataframe, it will be copied with column names but not row names. If x is something else (a vector, for example) it will be coerced into a one-column dataframe and copied without column names or row names. Char and factor in x will not be surrounded by quotes in the clipboard.

Value

Invisibly returns the contents of the clipboard. If .Last.value is displayed in RStudio's 'Environment' tab, you'll see its value change.

Authors

Source

Examples

clippy(mtcars)

# Clipboard contents:
# mpg  cyl disp  hp   drat  wt     qsec   vs  am  gear  carb
# 21   6   160   110  3.9   2.62   16.46  0   1   4     4
# 21   6   160   110  3.9   2.875  17.02  0   1   4     4
# ...

clippy(iris$Petal.Length)

# Clipboard contents:
# 1.4
# 1.4
# 1.3
# ...

clippy(colnames(iris))

# Clipboard contents:
# Sepal.Length
# Sepal.Width
# Petal.Length
# Petal.Width
# Species


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.