scale_rows: Scale rows

Description Usage Arguments Examples

View source: R/scale_rows.R

Description

Select the columns of interest and scale their rows. Scale function takes the default argument center, scale plus some additional, common with other function of the package. The output can be either appended into the input dataframe or you can drop the input keeping only the scaled data.

Usage

1
2
scale_rows(x, columns = "..all..", complete_match = FALSE, center = TRUE,
  scale = TRUE, label = "scaled_", drop_input = FALSE)

Arguments

x

A dataframe with the values to be normalized.

columns

Vector containing column names to be standardized. By default all columns will be selected "..all..". You can add a vector with the column names, or a part of the column name that is unique and use partial matching to identify columns (e.g. "values_"). If complete matching is used, specify complete_match argument to TRUE.

complete_match

Logical with default value FALSE that allows partial matching of the column names for selection of the column for normalizaiton. If set to TRUE, columns that match exactly with the input will be used.

center

See link{scale} function.

scale

See link{scale} function.

label

Label tag to be added in each collumn. Default value is "nmax_".

drop_input

Select if you want to append the normalized data into the input dataframe or keep only them. Logical with default value FALSE, meaning that the processed values will be added to the input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
df <- data.frame(text = c("A", "B", "C", "D", "E", "F", "G"),
                 V1 = c(1, 2, 3, 4, 3, 2, 1),
                 V2 = c(5, 6, 4, 3, NA, 6, 7),
                 V3 = c(3, 4, 5, 6, 7, 4, 3))

scaled_df <- scale_rows(x = df,
                        columns = c("V1", "V2", "V3"),
                        complete_match = TRUE,
                        drop_input = TRUE)

scaled_df <- scale_rows(x = df,
                        columns = "V",
                        complete_match = FALSE)

tkostas/komics documentation built on May 24, 2019, 7:31 a.m.