to_xy_value: Gather columns and rows of a matrix to variables x and y of a...

Description Usage Arguments Value Examples

View source: R/to_xy_value.R

Description

Gather columns and rows of a matrix to variables x and y of a tibble, with values passed to variable value.

Usage

1

Arguments

mat

A matrix.

grid

A named vector of length 2, with first element named x and second element named y.

Value

A tibble with variables x, y, value.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# Show that bci_elevation and bci_matrix contain the same information. They
# justdiffer in the class.
# library(tidyverse)
# library(bciex)
# 
# # Class is different
# class(bci_mat)
# class(bci_elevation)
# 
# # But contents are the same.
# # Tidy mat: each variable in a column; each observation in a row
# mat <- to_xy_value(bci_mat, grid = c(y = 5, x = 5))
# mat <- rename(mat, elev = value)
# # Arrange in the same way
# mat <- mat %>% arrange(x, y, elev)
# elev <- bci_elevation %>% arrange(x, y, elev)
# identical(mat, elev)

## End(Not run)

maurolepore/handy documentation built on May 21, 2019, 1:37 p.m.