data(deer)
sh_forest <- get_sh_forest()
mini_deer <- deer[1:20, ]
mini_deer |> extract_covariates(sh_forest)
mini_deer |> steps() |> extract_covariates(sh_forest)
# \donttest{
# Illustration of extracting covariates along the a step
mini_deer |> steps() |> random_steps() |>
extract_covariates(sh_forest) |> # extract at the endpoint
(\(.) mutate(., for_path = extract_covariates_along(., sh_forest)))() |>
# 1 = forest, lets calc the fraction of forest along the path
mutate(for_per = purrr::map_dbl(for_path, function(x) mean(x == 1)))
# }
Run the code above in your browser using DataLab