avg_dataframe: Average a dataframe with continuous and discrete variables...

View source: R/average.R

avg_dataframeR Documentation

Average a dataframe with continuous and discrete variables columnwise.

Description

Average a dataframe with continuous and discrete variables columnwise.

Usage

avg_dataframe(
  df,
  group_by = 1,
  rows_to_keep = NULL,
  cols_to_keep = NULL,
  sort_cols = FALSE
)

Arguments

df

A data frame to average across. Note: Only numeric columns will be averaged, while discrete columns will retain the first instance for each group.

group_by

Name or column of index to average valuesby.

rows_to_keep

Numeric, logical or character vectors of rows to keep in subset (length must be number of rows of df). Note: character for named rows only

cols_to_keep

Numeric, logical or character vectors of columns to keep in subset (length must be number of columns of df). Note: character for named columns only

sort_cols

logical, should we sort columns alphabetically?

Value

A data frame averaged column by column.


kazeera/hourglass documentation built on April 5, 2025, 7:18 a.m.