tidyterra (development version)
This release adds tidyverse methods for SpatVector objects and includes documentation reviewed with AI-assisted editing.
- Package documentation was reviewed and updated with AI-assisted editing.
New methods
The following methods were generated with AI assistance.
-
complete.SpatVector()supportstidyr::complete(). -
cross_join.SpatVector()matches eachSpatVectorfeature inxwith every row iny. -
expand.SpatVector()returns attribute combinations forSpatVectorobjects. -
group_map.SpatVector()andgroup_modify.SpatVector()apply functions to groupedSpatVectorobjects. -
group_nest.SpatVector()andnest_by.SpatVector()create tibbles withSpatVectorlist-columns. -
group_split.SpatVector()splits groupedSpatVectorobjects into a list ofSpatVectorobjects. -
group_trim.SpatVector()drops unused factor levels in grouping variables. -
nest.SpatVector()creates nestedSpatVectorlist-columns. -
nest_join.SpatVector()creates nested joins forSpatVectorinputs. -
reframe.SpatVector()can return any number of rows perSpatVectorgroup. -
rows_insert.SpatVector()and relatedrows_*()methods updateSpatVectorrows while preserving geometries. -
uncount.SpatVector()duplicatesSpatVectorfeatures according to a weighting variable. -
?unite.Spatcombines severalSpatRasterlayers orSpatVectorattributes.
tidyterra 1.1.0
CRAN release: 2026-03-11
- The minimum supported dplyr version is now 1.2.0.
- Vignettes and articles now use Quarto.
New methods
-
add_count.SpatVector()adds counts toSpatVectorobjects without dropping geometries (#195). -
arrange.SpatVector()now supports.locale, matchingdplyr::arrange(). -
count.SpatVector()now supports weighted counts withwt. The.dropargument 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 matchingSpatVectorgeometries (#196). -
mutate.Spatnow supports.keep,.beforeand.after, matchingdplyr::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.Spatis now marked as superseded, followingdplyr::transmute()in dplyr 1.1.0. Usemutate(.keep = "none")instead.
tidyterra 1.0.0
CRAN release: 2026-01-23
- The minimum supported R version is now 4.1.0.
- The minimum supported ggplot2 version is now 4.0.0.
-
ggplot2 4.0.0 deprecations have been adapted: in
geom_spatvector_label()andgeom_spatvector_text(), thelabel.sizeaesthetic has been replaced bylinewidth. Also,nudge_xandnudge_yare not explicitly documented and are passed toggplot2::geom_sf_label()andggplot2::geom_sf_text()through dots (...). -
get_coltab_pal()can extract colors with alpha values (#180). - New
autoplot.SpatExtent()andautoplot.SpatGraticule()methods. -
generics has been added to Imports, with new
?tidy.Spat,?glance.Spatand?required_pkgs.Spatmethods forSpatRaster,SpatVector,SpatGraticuleandSpatExtentobjects. -
?fortify.Spatmethods now use?tidy.Spatmethods under the hood. This includes the newfortify.SpatExtent()method. -
geom_spatraster_contour_text()is now a stable function. -
summarise.SpatVector()now supports the.byargument. -
testthat: Move snapshot testing to its own directory, which is included in
.Rbuildignore:./tests/testthat/test_ci.
tidyterra 0.7.1
CRAN release: 2025-04-07
- New argument in
geom_spatraster_*:mask_projection. When set toTRUE, it avoidsSpatRasterwrapping around on some projections (see #115 and #169, by @dramanica). - Fixed an old bug exposed after terra 1.8-42, where plots crashed when using
ggplot2::facet_wrap()in combination withcoord_sf()or with an implicit CRS change due to othersf/Spat*objects.
tidyterra 0.7.0
CRAN release: 2025-02-03
- The minimum supported terra version is now 1.8-10.
- metR has been removed from Suggests.
- Factor handling has been improved when several layers have different levels. This uses
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()andscale_*_grass_b()now truncate the legend when thelimitsargument is provided (#165 @Fan-iX). -
geom_spatraster()and the overall pivoting ofSpatRasterare now less strict with different layer classes: if several layers can be defined as numeric (i.e.double,integerandnumeric), the pivoting (and therefore the plot) can be performed. This is consistent withtidyr::pivot_longer()behavior (https://stackoverflow.com/questions/79292989).
tidyterra 0.6.2
CRAN release: 2025-01-08
- Added limited support for
SpatGraticuleobjects (seeterra::graticule(), #155). - New arguments in
geom_spatraster_rgb():stretchandzlim. Seeterra::plotRGB()for clarification. -
geom_spatraster()suggestsgeom_spatraster_rgb()when aSpatRasterwith RGB specification is detected (terra::has.RGB()isTRUE).
tidyterra 0.6.1
CRAN release: 2024-06-08
-
autoplot.SpatRaster()now also usesgrass_dbas the default palette. -
grass_dband thescale_fill_grass_c()family have been added as an implementation ofterra::map.pal(), the default palette forterra::plot()(> 1.7.78). - The
scale_fill_princess_c()scale family has been added. - Tests have been fixed.
tidyterra 0.6.0
CRAN release: 2024-04-22
- The minimum supported ggplot2 version is now 3.5.0.
-
fill.SpatVector()has been added. -
geom_spatraster_contour_text()has been implemented on top ofisoband::isolines_grob().
-
glimpse.SpatRaster()andglimpse.SpatVector()now display information using?tibble::print.tbl_dfapproach for the header and the footer. The body is still displayed transposed as ofdplyr::glimpse(). Seepillar::tbl_format_header()andpillar::tbl_format_footer()for examples. -
as_sf()converts aSpatVectorto asfobject with an additionaltbl_dfclass for pretty printing. -
fortify.SpatRaster()gains a new argumentpivotthat allows better integration with other ggplot2 geoms when pivoting. This wrapstidyr::pivot_longer(). -
pivot_longer.SpatVector()andpivot_wider.SpatVector()have been added. - Documentation has been tidied.
- metR added to Suggests.
tidyterra 0.5.2
CRAN release: 2024-01-19
- Tests have been adapted to ggplot2 3.5.0 (#129, @teunbrand).
- Package size has been reduced, especially in the external raster
asia.tif.
tidyterra 0.5.0
CRAN release: 2023-11-21
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 detectSpatRasterobjects with color tables. -
geom_spatraster()can now detectSpatRasterobjects with color tables. -
scale_fill_coltab()and itsscale_colour_*()family scales have been added for plottingSpatRasterobjects with color tables. -
tidyverse verbs keep the associated
coltabof aSpatRaster. - By default, all the discrete scales of tidyterra now have the following setup:
na.translate = FALSE. - By default, all non-discrete scales of tidyterra now have
na.value = "transparent"(#120). -
glimpse.Spat()now shows metadata on geometry type, CRS and other fields. - New messaging interface thanks to cli package.
tidyterra 0.4.0
CRAN release: 2023-03-17
- This release focuses heavily on
SpatVectorobjects, addingglimpse.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()andbind_spat_rows(). - Already implemented methods now work with
dplyr::group_by(). - The
SpatVectormethods no longer rely onsf::st_as_sf()coercion internally. Coercion between object classes is avoided as much as possible. - New
glimpse.SpatRaster()method forSpatRaster. -
as_sf(),as_spatvector()andis_grouped_spatvector()have been added.
tidyterra 0.3.2
CRAN release: 2023-02-24
-
pull_crs()no longer returns"NA"forsfobjects with any field equal toNA(#74). -
scales_*documentation has been improved (#73). - The dependency on the superseded crayon package has been removed in favor of cli.
- tidyverse has been removed from Suggests.
tidyterra 0.3.1
CRAN release: 2022-11-09
-
autoplot.SpatRaster()andautoplot.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()andfortify.SpatVector()methods have been added. - Three additional palettes are included in
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()andgeom_spatraster_contour_filled()have been adapted to the changes introduced in ggplot2 3.4.0, most notably the adoption oflinewidth = .2by default.
tidyterra 0.3.0
CRAN release: 2022-10-12
- Package back on CRAN.
- Libraries dplyr, tidyr and tibble are not attached by default. Needed functions are reexported instead.
-
geom_spatraster()can now avoid the defaultfillof the layer usinggeom_spatraster(fill = NA)orgeom_spatraster(aes(fill = NULL)). -
geom_spatraster()now supportsaes(fill = ggplot2::after_stat()). -
geom_spatraster()now handlesaes()and layers better internally. -
stat_spatraster()has been added. - Reduce the size of external files.
tidyterra 0.2.2
CRAN release: 2022-09-29
- Changes to how dplyr, tibble and tidyr are attached. These packages are listed on ‘Depends’ and are attached before tidyterra when
libraryorrequireis called. Messages on load can be suppressed withsuppressPackageStartupMessages(library(tidyterra)).
tidyterra 0.2.1
CRAN release: 2022-09-23
-
geom_spatraster_rgb()now works withfacet_wrap()(#35). - Faceting has been improved when plot facets are created using non-
Spat*layers. - Vignettes have been precomputed.
tidyterra 0.2.0
CRAN release: 2022-06-21
-
asia.tifhas been added toextdata. -
extdata/volcano2.tifhas 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()andscale_fill_wiki_c()have been added as new gradient scales for hypsometry. -
slice_min()andslice_max()no longer error forSpatRasterobjects. Thena.rmargument has also been added (#20). - The
volcano2dataset has been added.
tidyterra 0.0.1
- Performance has been improved by avoiding conversion to tibble as much as possible, using
data.tableobjects internally instead oftibbleobjects and adding compatibility with dtplyr. -
as_spatraster()now handles tibbles with characters and factors. -
geom_spatraster()andgeom_spatraster_rgb()have been simplified and tested. -
geom_spatraster_contour()and its family have been added. -
pull(),rename()andtransmute()methods have been added.
