avg_columns | R Documentation |
Given a matrix and a list where each element contains a numeric vector of the column indices to average, calculate a condensed matrix.
avg_columns(mat, dlist = NULL, year = NULL, composite = "8day")
mat |
Numeric matrix |
dlist |
List of numeric vectors, where each vector contains the column indices that should be merged (see example). If left blank, mat must be in order and have no gaps (i.e. a day with no data should be a column of all NA), and a year and "composite" are also required so that dlist can be automatically calculated using the 8day or monthly system. |
year |
Integer, only needed if dlist is NULL |
composite |
String, length of output composite, 8day or monthly (only needed if dlist is NULL) |
This can be used to take a matrix where rows = pixels and columns = days of the year, and average columns over 8day or month intervals to return, for example, a corresponding matrix of row=pixels and columns=weeks (where a "week" is 8days).
Numeric matrix with the same number of rows, and the number of columns equal to the length of dlist
mat <- matrix(runif(30), nrow=3)
avg_columns(mat, dlist=list(1:5, 6:8))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.