spatial_nndm_cv()is a new function for nearest neighbor distance matching cross-validation, as described in Milà et al. 2022 (doi: 10.1111/2041-210X.13851). NNDM was first implemented in CAST (https://cran.r-project.org/package=CAST).
CRAN release: 2023-01-17
spatial_clustering_cv()no longer accepts non-sf objects. Use
rsample::clustering_cv()for these instead (#126).
spatial_clustering_cv()now uses edge-to-edge distances, like the rest of the package, rather than centroids (#126).
All functions now have a
repeatsargument, defaulting to 1, allowing for repeated cross-validation (#122, #125, #126).
spatial_clustering_cv()now has a
distance_functionargument, set by default to
Minor improvements and fixes
spatial_buffer_vfold_cv()should now have the correct
spatial_buffer_vfold_cv()now has the correct
idvalues when using repeats (#116).
spatial_buffer_vfold_cv()now throws an error when
repeats > 1 && v >= nrow(data)(#116).
sfversion required is now
>= 1.0-9, so that unit objects can be passed to
autoplot()now handles repeated cross-validation properly (#123).
CRAN release: 2022-08-05
Mike Mahoney is taking over as package maintainer, as Julia Silge (who remains a package author) moves to focus on ModelOps work.
Functions will now return rsplits without
out_id, like most rsample functions, whenever
spatial_buffer_vfold_cv(), and buffering now support using sf or sfc objects with a missing CRS. The assumption is that data in an NA CRS is projected, with all distance values in the same unit as the projection. Trying to use alternative units will fail. Set a CRS if these assumptions aren’t correct.
spatial_buffer_vfold_cv()and buffering no longer support tibble or data.frame inputs (they now require sf or sfc objects). It was not easy to use these to begin with, but should have always caused an error: use
rsample::vfold_cv()instead or transform your data into an sf object.
spatial_buffer_vfold_cv()has had some attribute changes to match
strataattribute is now the name of the column used for stratification, or not set if there was no stratification.
breakshave been added as attributes
bufferare now set to 0 if they were passed as
CRAN release: 2022-06-17
spatial_buffer_vfold_cv()is a new function which wraps
rsample::vfold_cv(), allowing users to add inclusion radii and exclusion buffers to their vfold resamples. This is the supported way to perform spatially buffered leave-one-out cross validation (set
spatial_leave_location_out_cv()is a new function with wraps
rsample::group_vfold_cv(), allowing users to add inclusion radii and exclusion buffers to their vfold resamples.
spatial_block_cv()is a new function for performing spatial block cross-validation. It currently supports randomly assigning blocks to folds.
spatial_clustering_cv()gains an argument,
cluster_function, which specifies what type of clustering to perform.
cluster_function = "kmeans", the default, uses
stats::kmeans()for k-means clustering, while
cluster_function = "hclust"uses
stats::hclust()for hierarchical clustering. Users can also provide their own clustering function.
sfobjects! Coordinates are inferred automatically when using
sfobjects, and anything passed to
coordswill be ignored with a warning. Clusters made using
sfobjects will take coordinate reference systems into account (using
sf::st_distance()), unlike those made using data frames.
All resampling functions now support spatial buffering using two arguments.
radiuslets you specify an inclusion radius for your test set, where any data within
radiusof the original assessment set will be added to the assessment set.
bufferspecifies an exclusion buffer around the test set, where any data within
bufferof the assessment set (after
radiusis applied) will be excluded from both sets.
autoplot()now has a method for spatial resamples built from
sfobjects. It works both on
rsetobjects and on
rsplitobjects, and has a special method for outputs from
boston_canopyis a new dataset with data on tree canopy change over time in Boston, Massachusetts, USA. It uses a projected coordinate reference system and US customary units; see
?boston_canopyfor instructions on how to install these into your PROJ installation if needed.
The “Getting Started” vignette has been revised to demonstrate the new features and clustering methods.
A new vignette has been added walking through the spatial buffering process.