get_col_totals: Get column totals for a set of columns in a dataframe

Description Usage Arguments Value

View source: R/totals.R

Description

Calculates column totals for a set of columns in a dataframe and returns them as a vector. Use add_col_totals to append the column percentages to the input dataframe.

Usage

1
2
3
4
5
6
7
get_col_totals(
  data,
  from = 2,
  to = ncol(data),
  rows = 1:nrow(data),
  na.rm = FALSE
)

Arguments

data

A dataframe containing columns of numerical data to be summed by column.

from

The number or name of the column from which column totals 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 totals are calculated. The default is ncol(data), which means column totals are calculated across all remaining columms in the dataframe.

rows

A numeric vector of the rows to be summed. The default is all rows in the dataframe.

na.rm

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

Value

A numeric vector of column totals.


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