select_variables: Select or remove study variables

View source: R/design_structure.R

select_variablesR Documentation

Select or remove study variables

Description

Select or remove study variables

Usage

select_variables(data, keep = NULL, drop = NULL)

Arguments

data

Base data.frame, or a simulab_sim.

keep

Variables to retain, in the order given. A character vector of column names, or NULL (the default).

drop

Variables to remove, the others keeping their order. A character vector of column names, or NULL (the default). Only one of keep and drop may be given.

Value

A simulab_sim base data.frame with every row of data and the requested variables.

Examples

data <- data.frame(id = 1:5, keep_me = 1:5, drop_me = 6:10)
select_variables(data, keep = c("id", "keep_me"))
select_variables(data, drop = "drop_me")

simulab documentation built on Oct. 15, 2026, 5:08 p.m.