Description Usage Arguments Value Examples
Gather columns and rows of a matrix to variables x
and y
of a tibble,
with values passed to variable value
.
1 | to_xy_value(mat, grid)
|
mat |
A matrix. |
grid |
A named vector of length 2, with first element named x and second element named y. |
A tibble with variables x
, y
, value
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.