varnames_snippet: Creates a simple snippet code to generate a string vector of...

View source: R/gf.R

varnames_snippetR Documentation

Creates a simple snippet code to generate a string vector of all column names of a data frame

Description

The if the data frame has 3 columns named "x", "y" and "name with space" the function cats and on windows also copies to your clipboard the following code:

Usage

varnames_snippet(x)

Arguments

x

A data frame or other objects with names.

Details

c("x","y","`name with space`")

This can be helpful to specify vectors of control variables when using gf. If there are many variables it is just easier to remove not-used variables from the created code snippet than to write down manually all used variables.

Examples

df = data.frame(x=1,y=5,z=4,`a b`=4)
varnames_snippet(df)


skranz/glueformula documentation built on Oct. 12, 2024, 5:43 a.m.