Convert a matrix to a data frame with columns time, location, and one more containing the elements of the input matrix.
matrix_to_df(mat, name, locations = NULL, times = NULL)
A matrix with columns time, location, name
, where name
is specified in the input.
A matrix.
The name of the third column in the output matrix.
If not NULL
, a vector with the names of the
locations.
If not NULL
, a vector with the time points. If
NULL
, the matrix is assumed to be ordered with time point 1 in the
first row.