Learn R Programming

psycho (version 0.0.8)

normalize: Normalize (scale and reduce) numeric variables.

Description

Select numeric variables and normalize (Z-score) them.

Usage

normalize(df, except = NULL)

Arguments

df

Dataframe.

except

Character or list of characters of column names to be excluded from normalization.

Value

Dataframe.

Examples

Run this code
# NOT RUN {
df <- data.frame(
  Participant = as.factor(rep(1:50,each=2)),
  Condition = base::rep_len(c("A", "B"), 100),
  V1 = rnorm(100, 30, .2),
  V2 = runif(100, 3, 5),
  V3 = rnorm(100, 100, 10)
  )

dfZ <- normalize(df)
dfZ <- normalize(df, except="V3")
dfZ <- normalize(df, except=c("V1", "V2"))

# }

Run the code above in your browser using DataLab