scale_df: Scale numeric variables in a data frame

View source: R/data_scale_df.R

scale_dfR Documentation

Scale numeric variables in a data frame

Description

Applies base::scale() to numeric, integer, or logical columns in a data frame. Non-numeric columns are left unchanged.

Usage

scale_df(x, center = TRUE, scale = TRUE)

Arguments

x

A data frame or matrix.

center

Logical; if TRUE, center the variables.

scale

Logical; if TRUE, scale the variables.

Details

If x is not a data frame, base::scale() is applied directly.

Value

An object of the same class as x.

Examples

scale_df(iris)


doBy documentation built on June 30, 2025, 1:06 a.m.