Skip to content

Commit

Permalink
Merge pull request #55 from dieghernan/backtocran
Browse files Browse the repository at this point in the history
Prepare for CRAN
  • Loading branch information
dieghernan authored Oct 10, 2022
2 parents 42d11b4 + 95f6558 commit 1a0a673
Show file tree
Hide file tree
Showing 44 changed files with 399 additions and 286 deletions.
103 changes: 51 additions & 52 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cff-version: 1.2.0
message: 'To cite package "tidyterra" in publications use:'
type: software
license: MIT
title: 'tidyterra: ''tidyverse'' Methods and ''ggplot2'' Utils for ''terra'' Objects'
version: 0.2.2.9000
title: 'tidyterra: ''tidyverse'' Methods and ''ggplot2'' Helpers for ''terra'' Objects'
version: 0.3.0
doi: 10.5281/zenodo.6572471
abstract: Extension of the 'tidyverse' for 'SpatRaster' and 'SpatVector' objects of
the 'terra' package. It includes also new 'geom_' functions that provide a convenient
Expand All @@ -20,20 +20,19 @@ authors:
orcid: https://orcid.org/0000-0001-8457-4658
preferred-citation:
type: manual
title: 'tidyterra: tidyverse Methods and ggplot2 Utils for terra Objects'
title: 'tidyterra: tidyverse Methods and ggplot2 Helpers for terra Objects'
authors:
- family-names: Hernangómez
given-names: Diego
email: [email protected]
orcid: https://orcid.org/0000-0001-8457-4658
doi: 10.5281/zenodo.6572471
year: '2022'
version: 0.2.2.9000
version: 0.3.0
url: https://dieghernan.github.io/tidyterra/
abstract: Extension of the tidyverse for SpatRaster and SpatVector objects of the
terra package. It includes also new geom_ functions that provide a convenient
way of visualizing terra objects with ggplot2.
repository: https://CRAN.R-project.org/package=tidyterra
repository-code: https://github.com/dieghernan/tidyterra
url: https://dieghernan.github.io/tidyterra/
contact:
Expand All @@ -53,26 +52,6 @@ keywords:
- rstats-package
- terra
references:
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
notes: Depends
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: François
given-names: Romain
orcid: https://orcid.org/0000-0002-2444-4226
- family-names: Henry
given-names: Lionel
- family-names: Müller
given-names: Kirill
orcid: https://orcid.org/0000-0002-1416-3412
year: '2022'
url: https://CRAN.R-project.org/package=dplyr
version: '>= 1.0.0'
- type: software
title: 'R: A Language and Environment for Statistical Computing'
notes: Depends
Expand All @@ -85,33 +64,6 @@ references:
institution:
name: R Foundation for Statistical Computing
version: '>= 3.6.0'
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
notes: Depends
authors:
- family-names: Müller
given-names: Kirill
email: [email protected]
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=tibble
version: '>= 3.0.0'
- type: software
title: tidyr
abstract: 'tidyr: Tidy Messy Data'
notes: Depends
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
- family-names: Girlich
given-names: Maximilian
year: '2022'
url: https://CRAN.R-project.org/package=tidyr
version: '>= 1.0.0'
- type: software
title: cli
abstract: 'cli: Helpers for Developing Command Line Interfaces'
Expand Down Expand Up @@ -146,6 +98,26 @@ references:
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=data.table
- type: software
title: dplyr
abstract: 'dplyr: A Grammar of Data Manipulation'
notes: Imports
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
orcid: https://orcid.org/0000-0003-4757-117X
- family-names: François
given-names: Romain
orcid: https://orcid.org/0000-0002-2444-4226
- family-names: Henry
given-names: Lionel
- family-names: Müller
given-names: Kirill
orcid: https://orcid.org/0000-0002-1416-3412
year: '2022'
url: https://CRAN.R-project.org/package=dplyr
version: '>= 1.0.0'
- type: software
title: ggplot2
abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
Expand Down Expand Up @@ -243,6 +215,33 @@ references:
year: '2022'
url: https://CRAN.R-project.org/package=terra
version: '>= 1.5-12'
- type: software
title: tibble
abstract: 'tibble: Simple Data Frames'
notes: Imports
authors:
- family-names: Müller
given-names: Kirill
email: [email protected]
- family-names: Wickham
given-names: Hadley
email: [email protected]
year: '2022'
url: https://CRAN.R-project.org/package=tibble
version: '>= 3.0.0'
- type: software
title: tidyr
abstract: 'tidyr: Tidy Messy Data'
notes: Imports
authors:
- family-names: Wickham
given-names: Hadley
email: [email protected]
- family-names: Girlich
given-names: Maximilian
year: '2022'
url: https://CRAN.R-project.org/package=tidyr
version: '>= 1.0.0'
- type: software
title: isoband
abstract: 'isoband: Generate Isolines and Isobands from Regularly Spaced Elevation
Expand Down
14 changes: 7 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tidyterra
Title: 'tidyverse' Methods and 'ggplot2' Utils for 'terra' Objects
Version: 0.2.2.9000
Title: 'tidyverse' Methods and 'ggplot2' Helpers for 'terra' Objects
Version: 0.3.0
Authors@R: c(
person("Diego", "Hernangómez", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658")),
Expand All @@ -18,20 +18,20 @@ URL: https://dieghernan.github.io/tidyterra/,
https://github.com/dieghernan/tidyterra
BugReports: https://github.com/dieghernan/tidyterra/issues
Depends:
dplyr (>= 1.0.0),
R (>= 3.6.0),
tibble (>= 3.0.0),
tidyr (>= 1.0.0)
R (>= 3.6.0)
Imports:
cli (>= 3.0.0),
crayon,
data.table,
dplyr (>= 1.0.0),
ggplot2 (>= 3.1.0),
magrittr,
rlang,
scales,
sf (>= 1.0.0),
terra (>= 1.5-12)
terra (>= 1.5-12),
tibble (>= 3.0.0),
tidyr (>= 1.0.0)
Suggests:
isoband,
knitr,
Expand Down
17 changes: 17 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ S3method(transmute,SpatVector)
export("%>%")
export(as_coordinates)
export(as_spatraster)
export(as_tibble)
export(compare_spatrasters)
export(cross_blended.colors)
export(cross_blended.colors2)
export(drop_na)
export(filter)
export(geom_spatraster)
export(geom_spatraster_contour)
export(geom_spatraster_contour_filled)
Expand All @@ -54,7 +57,13 @@ export(geom_spatvector_text)
export(hypso.colors)
export(hypso.colors2)
export(is_regular_grid)
export(mutate)
export(pull)
export(pull_crs)
export(relocate)
export(rename)
export(rename_with)
export(replace_na)
export(scale_fill_cross_blended_b)
export(scale_fill_cross_blended_c)
export(scale_fill_cross_blended_d)
Expand All @@ -76,10 +85,18 @@ export(scale_fill_whitebox_d)
export(scale_fill_wiki_b)
export(scale_fill_wiki_c)
export(scale_fill_wiki_d)
export(select)
export(slice)
export(slice_colrows)
export(slice_cols)
export(slice_head)
export(slice_max)
export(slice_min)
export(slice_rows)
export(slice_sample)
export(slice_tail)
export(stat_spatraster)
export(transmute)
export(whitebox.colors)
export(wiki.colors)
importFrom(dplyr,everything)
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# tidyterra (development version)I
# tidyterra 0.3.0

- Package back to CRAN.

- Libraries **dplyr**, **tidyr**, **tibble** are not attached by default.
Needed functions are reexported instead.

- Improvements on `geom_spatraster()`:

Expand Down
9 changes: 6 additions & 3 deletions R/as_tibble.Spat.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#'
#' `as_tibble()` method for SpatRaster and SpatVector.
#'
#' @rdname as_tibble
#' @name as_tibble
#' @rdname as_tibble.Spat
#' @name as_tibble.Spat
#'
#' @return
#' A tibble.
Expand Down Expand Up @@ -104,7 +104,7 @@ as_tibble.SpatRaster <- function(x, ...,
}

#' @export
#' @rdname as_tibble
#' @rdname as_tibble.Spat
as_tibble.SpatVector <- function(x, ..., .name_repair = "unique") {
df <- tibble::as_tibble(terra::as.data.frame(x, ...),
.name_repair = .name_repair
Expand Down Expand Up @@ -188,3 +188,6 @@ make_layer_names <- function(x) {
names(x) <- newnames
return(x)
}

#' @export
tibble::as_tibble
7 changes: 5 additions & 2 deletions R/drop_na.Spat.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#'
#' @export
#'
#' @rdname drop_na
#' @name drop_na
#' @rdname drop_na.SpatVector
#' @name drop_na.SpatVector
#'
#' @importFrom tidyr drop_na
#'
Expand Down Expand Up @@ -189,3 +189,6 @@ drop_na.SpatRaster <- function(data, ...) {

return(newrast)
}

#' @export
tidyr::drop_na
11 changes: 7 additions & 4 deletions R/filter.Spat.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
#' See **Examples** and section `About layer names` on [as_tibble()].
#'
#' @export
#' @rdname filter
#' @name filter
#' @rdname filter.Spat
#' @name filter.Spat
#'
#' @seealso [dplyr::filter()]
#'
#' @family dplyr.methods
#' @family single table verbs
#'
#' @importFrom dplyr filter
#' @inheritParams select
#' @inheritParams select.Spat
#' @param ... [`data-masking`][dplyr::filter] Expressions that return a logical
#' value, and are defined in terms of the layers/attributes in `.data`. If
#' multiple expressions are included, they are combined with the `&` operator.
Expand Down Expand Up @@ -123,7 +123,7 @@ filter.SpatRaster <- function(.data, ..., .preserve = FALSE,
}

#' @export
#' @rdname filter
#' @rdname filter.Spat
filter.SpatVector <- function(.data, ..., .preserve = FALSE) {

# Use sf method
Expand All @@ -132,3 +132,6 @@ filter.SpatVector <- function(.data, ..., .preserve = FALSE) {

return(terra::vect(filtered))
}

#' @export
dplyr::filter
20 changes: 13 additions & 7 deletions R/mutate.Spat.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#'
#' @return A Spat* object of the same class than `.data`. See **Methods**.
#'
#' @inheritParams select
#' @inheritParams select.Spat
#' @param ... [`data-masking`][dplyr::mutate] Name-value pairs. The name gives
#' the name of the layer/attribute in the output. See [dplyr::mutate()].
#'
#' @export
#' @rdname mutate
#' @name mutate
#' @rdname mutate.Spat
#' @name mutate.Spat
#'
#' @aliases transmute
#' @aliases transmute.Spat
#'
#' @importFrom dplyr mutate
#'
Expand Down Expand Up @@ -114,7 +114,7 @@ mutate.SpatRaster <- function(.data, ...) {
return(final_rast)
}
#' @export
#' @rdname mutate
#' @rdname mutate.Spat
mutate.SpatVector <- function(.data, ...) {

# Use sf method
Expand All @@ -124,7 +124,7 @@ mutate.SpatVector <- function(.data, ...) {
return(terra::vect(mutated))
}
#' @export
#' @rdname mutate
#' @rdname mutate.Spat
#' @importFrom dplyr transmute
transmute.SpatRaster <- function(.data, ...) {
df <- as_tbl_spat_attr(.data)
Expand Down Expand Up @@ -163,7 +163,7 @@ transmute.SpatRaster <- function(.data, ...) {
return(final_rast)
}
#' @export
#' @rdname mutate
#' @rdname mutate.Spat
transmute.SpatVector <- function(.data, ...) {

# Use sf method
Expand All @@ -172,3 +172,9 @@ transmute.SpatVector <- function(.data, ...) {

return(terra::vect(transm))
}

#' @export
dplyr::mutate

#' @export
dplyr::transmute
Loading

0 comments on commit 1a0a673

Please sign in to comment.