Skip to content

Instantly share code, notes, and snippets.

@mikemahoney218
Created June 21, 2022 15:16
Show Gist options
  • Save mikemahoney218/0a468d1f6ac5bf8292b811e8763a53f1 to your computer and use it in GitHub Desktop.
Save mikemahoney218/0a468d1f6ac5bf8292b811e8763a53f1 to your computer and use it in GitHub Desktop.
library(spatialsample)
# Might need to get the CRS if you haven't before:
sf::sf_proj_network(TRUE)
sf::sf_add_proj_units()
spatial_clustering_cv(boston_canopy, v = 5) |>
autoplot()
spatial_block_cv(boston_canopy, v = 5, method = "snake") |>
autoplot()
spatial_buffer_vfold_cv(boston_canopy, radius = NULL, buffer = 100, v = 15) |>
(\(x) lapply(x$splits, \(y) print(autoplot(y))))() |>
gifski::save_gif("animation.gif")
data(ames, package = "modeldata")
ames_sf <- sf::st_as_sf(ames, coords = c("Longitude", "Latitude"), crs = 4326)
spatial_leave_location_out_cv(ames_sf, Neighborhood, 5) |>
autoplot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment