This release adds tidyverse methods for SpatVector objects and includes
documentation reviewed with explicit AI-assisted editing.
The following methods were generated with AI assistance.
complete.SpatVector() supports tidyr::complete().cross_join.SpatVector() matches each SpatVector feature in x with every
row in y.expand.SpatVector() returns attribute combinations for SpatVector objects.group_map.SpatVector() and group_modify.SpatVector() apply functions to
grouped SpatVector objects.group_nest.SpatVector() and nest_by.SpatVector() create tibbles with
SpatVector list-columns.group_split.SpatVector() splits grouped SpatVector objects into a list of
SpatVector objects.group_trim.SpatVector() drops unused factor levels in grouping variables.nest.SpatVector() creates nested SpatVector list-columns.nest_join.SpatVector() creates nested joins for SpatVector inputs.reframe.SpatVector() can return any number of rows per SpatVector group.rows_insert.SpatVector() and related rows_*() methods update SpatVector
rows while preserving geometries.uncount.SpatVector() duplicates SpatVector features according to a
weighting variable.?unite.Spat combines several SpatRaster layers or SpatVector attributes.add_count.SpatVector() adds counts to SpatVector objects without dropping
geometries (#195).arrange.SpatVector() now supports .locale, matching dplyr::arrange().count.SpatVector() now supports weighted counts with wt. The .drop
argument is deprecated because empty groups are always removed.fill.SpatVector() now supports .by, matching the stable dplyr 1.2.0
argument (#193).filter.SpatVector() now supports .by, matching the stable dplyr 1.2.0
argument (#193).filter.SpatVector() now supports .preserve, which was previously ignored.filter_out.SpatVector() filters out matching SpatVector geometries (#196).mutate.Spat now supports .keep, .before and .after, matching
dplyr::mutate().mutate.SpatVector() now supports .by, matching the stable dplyr 1.2.0
argument (#193).slice.SpatVector() methods now support .by, matching the stable dplyr
1.2.0 argument (#193).summarise.SpatVector() keeps support for .by, which has moved from
experimental to stable in dplyr 1.2.0 (#193).transmute.Spat is now marked as superseded, following dplyr::transmute()
in dplyr 1.1.0. Use mutate(.keep = "none") instead.geom_spatvector_label()
and geom_spatvector_text(), the label.size aesthetic has been replaced by
linewidth. Also, nudge_x and nudge_y are not explicitly documented and
are passed to ggplot2::geom_sf_label() and ggplot2::geom_sf_text() through
dots (...).get_coltab_pal() can extract colors with alpha values (#180).autoplot.SpatExtent() and autoplot.SpatGraticule() methods.?tidy.Spat, ?glance.Spat
and ?required_pkgs.Spat methods for SpatRaster, SpatVector,
SpatGraticule and SpatExtent objects.?fortify.Spat methods now use ?tidy.Spat methods under the hood. This
includes the new fortify.SpatExtent() method.geom_spatraster_contour_text() is now a stable function.summarise.SpatVector() now supports the .by argument..Rbuildignore: ./tests/testthat/test_ci.geom_spatraster_*: mask_projection. When set to TRUE, it
avoids SpatRaster wrapping around on some projections (see #115 and #169, by
@dramanica).ggplot2::facet_wrap() in combination with coord_sf() or with an
implicit CRS change due to other sf/Spat* objects.terra::combineLevels() from terra >= 1.8-10. See
https://stackoverflow.com/questions/79340152.scale_*_cross_blended_tint_c(), scale_*_cross_blended_tint_b(),
scale_*_hypso_tint_c(), scale_*_hypso_tint_b(), scale_*_grass_c() and
scale_*_grass_b() now truncate the legend when the limits argument is
provided (#165 @Fan-iX).geom_spatraster() and the overall pivoting of SpatRaster are now less
strict with different layer classes: if several layers can be defined as
numeric (i.e. double, integer and numeric), the pivoting (and therefore
the plot) can be performed. This is consistent with tidyr::pivot_longer()
behavior (https://stackoverflow.com/questions/79292989).SpatGraticule objects (see terra::graticule(),
#155).geom_spatraster_rgb(): stretch and zlim. See
terra::plotRGB() for clarification.geom_spatraster() suggests geom_spatraster_rgb() when a SpatRaster with
RGB specification is detected (terra::has.RGB() is TRUE).autoplot.SpatRaster() now also uses grass_db as the default palette.grass_db and the scale_fill_grass_c() family have been added as an
implementation of terra::map.pal(), the default palette for terra::plot()
(> 1.7.78).scale_fill_princess_c() scale family has been added.fill.SpatVector() has been added.geom_spatraster_contour_text() has been implemented on top of
isoband::isolines_grob()
glimpse.SpatRaster() and glimpse.SpatVector() now display information
using ?tibble::print.tbl_df approach for the header and the footer. The body
is still displayed transposed as of dplyr::glimpse(). See
pillar::tbl_format_header() and pillar::tbl_format_footer() for examples.as_sf() converts a SpatVector to a sf object with an additional tbl_df
class for pretty printing.fortify.SpatRaster() gains a new argument pivot that allows better
integration with other ggplot2 geoms when pivoting. This wraps
tidyr::pivot_longer().pivot_longer.SpatVector() and pivot_wider.SpatVector() have been added.asia.tif.as_sf() have been adjusted (#124).tidyterra has been accepted on JOSS. Please use the result of
citation("tidyterra") or the following string:
Hernangómez, D. (2023). "Using the tidyverse with terra objects: the tidyterra package." Journal of Open Source Software, 8(91), 5751. ISSN 2475-9066, https://doi.org/10.21105/joss.05751
Other changes in this version:
autoplot.SpatRaster() can now detect SpatRaster objects with color tables.geom_spatraster() can now detect SpatRaster objects with color tables.scale_fill_coltab() and its scale_colour_*() family scales have been added
for plotting SpatRaster objects with color tables.coltab of a SpatRaster.na.translate = FALSE.na.value = "transparent" (#120).glimpse.Spat() now shows metadata on geometry type, CRS and other fields.SpatVector objects, adding
glimpse.SpatVector(), arrange.SpatVector(), distinct.SpatVector(),
inner_join.SpatVector(), left_join.SpatVector(),
right_join.SpatVector(), full_join.SpatVector(), semi_join.SpatVector(),
anti_join.SpatVector(), summarise.SpatVector(), rowwise.SpatVector(),
group_by.SpatVector(), ungroup.SpatVector(), count.SpatVector(),
tally.SpatVector(), bind_spat_cols() and bind_spat_rows().dplyr::group_by().SpatVector methods no longer rely on sf::st_as_sf() coercion
internally. Coercion between object classes is avoided as much as possible.glimpse.SpatRaster() method for SpatRaster.as_sf(), as_spatvector() and is_grouped_spatvector() have been added.pull_crs() no longer returns "NA" for sf objects with any field equal to
NA (#74).scales_* documentation has been improved (#73).autoplot.SpatRaster() and autoplot.SpatVector() methods have been added.
autoplot.SpatRaster() is now smarter when identifying the type of plot to
produce and can still be overridden with arguments.fortify.SpatRaster() and fortify.SpatVector() methods have been added.hypso.colors(): "artic",
"meyers" and "nordisk-familjebok".scale_colour_*() scales have been added to all palettes.ggplot2::aes_string() is no longer used.geom_spatraster_contour() and geom_spatraster_contour_filled() have been
adapted to the changes introduced in ggplot2 3.4.0, most notably the
adoption of linewidth = .2 by default.geom_spatraster() can now avoid the default fill of the layer using
geom_spatraster(fill = NA) or geom_spatraster(aes(fill = NULL)).geom_spatraster() now supports aes(fill = ggplot2::after_stat()).geom_spatraster() now handles aes() and layers better internally.stat_spatraster() has been added.library or require is called. Messages on load can be suppressed with
suppressPackageStartupMessages(library(tidyterra)).geom_spatraster_rgb() now works with facet_wrap() (#35).Spat*
layers.asia.tif has been added to extdata.extdata/volcano2.tif has been recreated using official DEM information from
New Zealand. Source: Auckland LiDAR 1m DEM
(2013).scale_fill_cross_blended_c(), scale_fill_hypso_c(),
scale_fill_whitebox_c() and scale_fill_wiki_c() have been added as new
gradient scales for hypsometry.slice_min() and slice_max() no longer error for SpatRaster objects. The
na.rm argument has also been added (#20).volcano2 dataset has been added.data.table objects internally instead of tibble objects
and adding compatibility with dtplyr.as_spatraster() now handles tibbles with characters and factors.geom_spatraster() and geom_spatraster_rgb() have been simplified and
tested.geom_spatraster_contour() and its family have been added.pull(), rename() and transmute() methods have been added.