Description Usage Arguments Value Examples
Given a data frame with columns x1
, x2
, x3
, . . . , xn
and a column
value
, create an array arr
of dimension n
where arr[x1, x2, . . ., xn] = value
.
1 | coords_to_arr(df, missing_value = NA, check_duplicates = TRUE)
|
df |
A data frame whose columns are named |
missing_value |
Coordinates of |
check_duplicates |
Check for duplicate coordinates in the data frame |
An n
dimensional array with the same type as df$value
.
1 2 3 4 5 6 7 8 9 10 | coords <- tibble::tribble(~x1, ~x2, ~value,
1, 1, 3,
1, 2, 7,
2, 2, 0)
coords_to_arr(coords)
coords <- tibble::tribble(~x1, ~x2, ~ x3, ~value,
1, 1, 3, 3,
1, 2, 2, 7,
2, 2, 1, 0)
coords_to_arr(coords)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.