Description Usage Arguments Value Examples
predict_grid
allows to conveniently use the tessellation output as a
model to predict values for arbitrary points. See the bleiglass JOSS paper and
vignette("complete_example", "bleiglas")
for an example application.
attribute_grid_points_to_polygons
is a helper function that does the
important step of point-to-polygon attribution, which might be useful by
itself.
1 2 3 | predict_grid(x, prediction_grid, unit_scaling = c(1, 1, 1), ...)
attribute_grid_points_to_polygons(prediction_grid, polygon_edges)
|
x |
List of data.tables/data.frames with the input points that define the tessellation model:
|
prediction_grid |
data.table/data.frame with the points that should be predicted by the tessellation model:
|
unit_scaling |
passed to tessellate - see the documentation there |
... |
Further variables passed to |
polygon_edges |
polygon points as returned by |
list of data.tables with polygon attribution and predictions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | x <- lapply(1:5, function(i) {
current_iteration <- data.table::data.table(
id = 1:5,
x = c(1, 2, 3, 2, 1) + rnorm(5, 0, 0.3),
y = c(3, 1, 4, 4, 3) + rnorm(5, 0, 0.3),
z = c(1, 3, 4, 2, 5) + rnorm(5, 0, 0.3),
value1 = c("Brot", "Kaese", "Wurst", "Gurke", "Brot"),
value2 = c(5.3, 5.1, 5.8, 1.0, 1.2)
)
data.table::setkey(current_iteration, "x", "y", "z")
unique(current_iteration)
})
all_iterations <- data.table::rbindlist(x)
prediction_grid <- expand.grid(
x = seq(min(all_iterations$x), max(all_iterations$x), length.out = 10),
y = seq(min(all_iterations$y), max(all_iterations$y), length.out = 10),
z = seq(min(all_iterations$z), max(all_iterations$z), length.out = 5)
)
bleiglas::predict_grid(x, prediction_grid, cl = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.