std_data: Standardize Selected Variables

View source: R/lm_betaselect.R

std_dataR Documentation

Standardize Selected Variables

Description

Standardize selected variables in a data frame or similar object.

Usage

std_data(data, to_standardize)

Arguments

data

A data frame or similar object.

to_standardize

A character vector of the column names of variables to be standardized.

Details

This is a helper functions to be used by lm_betaselect() and glm_betaselect(). It assumes that the variables selected has been checked whether they are numeric.

Value

A data frame similar to data, with selected variables standardized.

Author(s)

Shu Fai Cheung https://orcid.org/0000-0002-9871-9448

Examples


data(data_test_mod_cat)
dat <- data_test_mod_cat
dat <- std_data(dat, to_standardize = c("iv", "dv"))
colMeans(dat[, c("dv", "iv")])
apply(dat[, c("dv", "iv")], 2, sd)


betaselectr documentation built on April 3, 2025, 8:51 p.m.