Learn R Programming

scanstatistics (version 1.0.1)

matrix_to_df: 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.