sumncol {exvatools} | R Documentation |
Sum every nth column of a matrix and name the resulting columns
Description
Groups a matrix by columns, summing every Nth column. Matrix should be multiple of N.
Usage
sumncol(df, N, col_names = NULL)
Arguments
df |
A matrix with named rows and columns. |
N |
Integer, specifying the resulting number of columns. |
col_names |
String vector of length N, with names to assign to the resulting columns. |
Value
A matrix with N columns, where each columns is the sum of every Nth column of the original matrix.
Examples
wio <- make_wio("wiodtest", quiet = TRUE)
sumncol(wio$Yfd, wio$dims$FD, paste0("WLD", "_", wio$names$fd_names))
[Package exvatools version 0.8.0 Index]