Learn R Programming

exvatools (version 0.9.0)

sumgcols: 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)

Value

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

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.

Examples

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

Run the code above in your browser using DataLab