add_factor {lgpr}R Documentation

Easily add a categorical covariate to a data frame

Description

Easily add a categorical covariate to a data frame

Usage

add_factor(data, x, id_var = "id")

Arguments

data

the original data frame

x

A named vector containing the category for each individual. The names should specify the individual id.

id_var

name of the id variable in data

Value

A data frame with one column added. The new column will have same name as the variable passed as input x.

See Also

Other data frame handling functions: add_dis_age(), add_factor_crossing(), adjusted_c_hat(), new_x(), split()


[Package lgpr version 1.2.4 Index]