matrix_to_df: Convert a matrix to a data frame.

View source: R/utility_functions.R

matrix_to_dfR Documentation

Convert a matrix to a data frame.

Description

Convert a matrix to a data frame with columns time, location, and one more containing the elements of the input matrix.

Usage

matrix_to_df(mat, name, locations = NULL, times = NULL)

Arguments

mat

A matrix.

name

The name of the third column in the output matrix.

locations

If not NULL, a vector with the names of the locations.

times

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.

Value

A matrix with columns time, location, name, where name is specified in the input.


scanstatistics documentation built on Feb. 16, 2023, 10:32 p.m.