get_col_sums_added: get column sums added to a dataframe

Description Usage Arguments Author(s) Examples

View source: R/get_col_sums.R

Description

This function returns a new dataframe with its last row being the column sums of the original dataframe. Note that the first column of the input dataframe must be of character type.

Usage

1
get_col_sums_added(a_df, desc_of_row = "Total")

Arguments

a_df

A dataframe.

desc_of_row

Description of the row, and the default value is 'Total'.

Author(s)

Lingyun (Larry) Zhang lyzhang10@gmail.com

Examples

1
2
3
4
5
6
7
8
df <-
  data.frame(x = letters[1:10],
             y = 1,
             z = 2,
             w = rnorm(10),
             stringAsFactor = FALSE)

df_with_col_sums <- get_col_sums_added(df)

zhanglynz/dfexplorer documentation built on May 23, 2021, 8:38 a.m.