sumgcols {exvatools}R Documentation

Sum groups of columns of a matrix and name the resulting columns

Description

Groups a matrix by columns, by summing blocks of columns of size n each. Matrix columns should be multiple of n.

Usage

sumgcols(df, n, col_names = NULL)

Arguments

df

A matrix with named rows and columns.

n

Integer, specifying the size of each group.

col_names

String vector of length n, with names to assign to the resulting columns.

Value

A matrix where each column is the sum of groups of n columns of the original matrix.

Examples

wio <- make_wio("wiodtest", quiet = TRUE)
sumgcols(wio$Yfd, wio$dims$FD, wio$names$g_names)

[Package exvatools version 0.8.0 Index]