tidy_mat: Convert a 2 x _m_ Matrix to an m x 2 Tibble for Plotting

Description Usage Arguments Value Examples

View source: R/tidy_mat.R

Description

This function transforms a matrix into a tibble suitable for plotting. Custom column names may be supplied.

Usage

1
tidy_mat(m, col_names = c("x", "y"))

Arguments

m

A 2 x m matrix.

col_names

A character vector of two distinct column names for the output. Defaults to c("x", "y"), which should cover most use cases.

Value

A tibble organizing the matrix's values in plottable form, with columns x and y and one row for each column vector of the original matrix.

Examples

1
tidy_mat(matrix(rnorm(n = 20, mean = 5, sd = 3), nrow = 2))

ryan-heslin/matador documentation built on Dec. 22, 2021, 8:17 p.m.