shrink_df: Mock-up shrink data.frame function

shrink_dfR Documentation

Mock-up shrink data.frame function

Description

Mock-up shrink data.frame function

Usage

shrink_df(
  df,
  by,
  string_func = jamba::cPasteU,
  num_func = mean,
  extra_funcs = NULL,
  do_test = FALSE,
  verbose = FALSE,
  ...
)

Arguments

df

data.frame or compatible input class.

by

character vector of one or more colnames(df), used to define the row grouping.

string_func

function used for character and other non-numeric column types.

num_func

function used for numeric column types.

extra_funcs

list of functions with list names that match values in colnames(df), to be applied to specific columns in df. These functions will therefore override the default functions defined by string_func and num_func.

do_test

logical indicating whether to perform an internal test with internally-generated argument values.

verbose

logical indicating whether to print verbose output.

...

additional arguments are ignored.

Details

This function is a simplified version of shrinkDataFrame() which is intended to use more modern methods from the R package data.table.

The general idea is to collapse numeric columns using num_func, and collapse character and all other columns using string_func.

Any exceptions, where a different function should be applied, are passed via argument extra_funcs which is a list of functions named by values in colnames(df).

See Also

Other jamses utilities: fold_to_log2fold(), log2fold_to_fold(), mark_stat_hits(), se_collapse_by_column(), se_collapse_by_row(), se_rbind(), shrinkDataFrame(), strsplitOrdered(), sub_split_vector(), update_function_params(), update_list_elements()


jmw86069/jamses documentation built on May 31, 2024, 1:36 p.m.