get_col_percent: Calculate column percentages for a set of columns in a...

Description Usage Arguments Value

View source: R/percent.R

Description

Calculates column percentages for a set of colummns in a dataframe and returns those percentages along with any preceding columns containing row labels or other data. Use add_col_percent to append the column percentages to the input dataframe.

Usage

1
get_col_percent(data, from = 2, to = ncol(data), na.rm = FALSE)

Arguments

data

A dataframe containing columns of numerical data to be expressed as column percentages.

from

The number or name of the column from which column percentages are calculated. The default is 2, assuming one column for row labels. Use 1 if there are no preceding data columns.

to

The number or name of the column to which column percentages are calculated. The default is ncol(data), which means column percentages are calculated across all remaining columms in the dataframe.

na.rm

A boolean which if TRUE ignores NAs in calculating percentages. The default value is FALSE.

Value

A tibble containing column percentages and any preceding columns.


olihawkins/cltools documentation built on Sept. 14, 2020, 7:25 a.m.