Closed wlangera closed 3 months ago
p_norm argument does not work properly.
p_norm
# Load packages library(gcube) # simulate biodiversity data cubes library(sf) # work with spatial objects library(tidyverse) # data wrangling and visualisation # Lets create a random point with 25 meter coordinate uncertainty. # We sample 1000 times using normal randomisation point_df <- tibble( x = 200, y = 500, time_point = 1, coordinateUncertaintyInMeters = 25) %>% st_as_sf(coords = c("x", "y")) n_sim <- 1000 # Take 1000 samples with normal randomisation list_samples_normal <- vector("list", length = n_sim) for (i in seq_len(n_sim)) { sampled_point_normal <- sample_from_binormal_circle(point_df, p_norm = 0.95) sampled_point_normal$sim <- i list_samples_normal[[i]] <- sampled_point_normal } samples_normal_df <- do.call(rbind.data.frame, list_samples_normal) # Visualise the samples coordinates_normal_df <- data.frame(st_coordinates(samples_normal_df)) coordinates_point_df <- data.frame(st_coordinates(point_df)) ggplot() + geom_point(data = coordinates_normal_df, aes(x = X, y = Y), colour = "cornflowerblue") + geom_segment(data = coordinates_point_df, aes(x = X, xend = X + 25, y = Y, yend = Y), linewidth = 1.5, colour = "darkgreen") + geom_label(aes(y = 503, x = 212.5, label = "25 m"), colour = "black", size = 5) + stat_ellipse(data = coordinates_normal_df, aes(x = X, y = Y), level = 0.975, linewidth = 1.5, color = "firebrick") + geom_point(data = coordinates_point_df, aes(x = X, y = Y), color = "firebrick", size = 2) + coord_fixed() + theme_minimal()
or only adjust documentation?
p_norm
argument does not work properly.