Skip to content

Commit 1a0a673

Browse files
authored
Merge pull request #55 from dieghernan/backtocran
Prepare for CRAN
2 parents 42d11b4 + 95f6558 commit 1a0a673

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+399
-286
lines changed

CITATION.cff

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ cff-version: 1.2.0
77
message: 'To cite package "tidyterra" in publications use:'
88
type: software
99
license: MIT
10-
title: 'tidyterra: ''tidyverse'' Methods and ''ggplot2'' Utils for ''terra'' Objects'
11-
version: 0.2.2.9000
10+
title: 'tidyterra: ''tidyverse'' Methods and ''ggplot2'' Helpers for ''terra'' Objects'
11+
version: 0.3.0
1212
doi: 10.5281/zenodo.6572471
1313
abstract: Extension of the 'tidyverse' for 'SpatRaster' and 'SpatVector' objects of
1414
the 'terra' package. It includes also new 'geom_' functions that provide a convenient
@@ -20,20 +20,19 @@ authors:
2020
orcid: https://orcid.org/0000-0001-8457-4658
2121
preferred-citation:
2222
type: manual
23-
title: 'tidyterra: tidyverse Methods and ggplot2 Utils for terra Objects'
23+
title: 'tidyterra: tidyverse Methods and ggplot2 Helpers for terra Objects'
2424
authors:
2525
- family-names: Hernangómez
2626
given-names: Diego
2727
email: diego.hernangomezherrero@gmail.com
2828
orcid: https://orcid.org/0000-0001-8457-4658
2929
doi: 10.5281/zenodo.6572471
3030
year: '2022'
31-
version: 0.2.2.9000
31+
version: 0.3.0
3232
url: https://dieghernan.github.io/tidyterra/
3333
abstract: Extension of the tidyverse for SpatRaster and SpatVector objects of the
3434
terra package. It includes also new geom_ functions that provide a convenient
3535
way of visualizing terra objects with ggplot2.
36-
repository: https://CRAN.R-project.org/package=tidyterra
3736
repository-code: https://github.com/dieghernan/tidyterra
3837
url: https://dieghernan.github.io/tidyterra/
3938
contact:
@@ -53,26 +52,6 @@ keywords:
5352
- rstats-package
5453
- terra
5554
references:
56-
- type: software
57-
title: dplyr
58-
abstract: 'dplyr: A Grammar of Data Manipulation'
59-
notes: Depends
60-
authors:
61-
- family-names: Wickham
62-
given-names: Hadley
63-
email: hadley@rstudio.com
64-
orcid: https://orcid.org/0000-0003-4757-117X
65-
- family-names: François
66-
given-names: Romain
67-
orcid: https://orcid.org/0000-0002-2444-4226
68-
- family-names: Henry
69-
given-names: Lionel
70-
- family-names: Müller
71-
given-names: Kirill
72-
orcid: https://orcid.org/0000-0002-1416-3412
73-
year: '2022'
74-
url: https://CRAN.R-project.org/package=dplyr
75-
version: '>= 1.0.0'
7655
- type: software
7756
title: 'R: A Language and Environment for Statistical Computing'
7857
notes: Depends
@@ -85,33 +64,6 @@ references:
8564
institution:
8665
name: R Foundation for Statistical Computing
8766
version: '>= 3.6.0'
88-
- type: software
89-
title: tibble
90-
abstract: 'tibble: Simple Data Frames'
91-
notes: Depends
92-
authors:
93-
- family-names: Müller
94-
given-names: Kirill
95-
email: krlmlr+r@mailbox.org
96-
- family-names: Wickham
97-
given-names: Hadley
98-
email: hadley@rstudio.com
99-
year: '2022'
100-
url: https://CRAN.R-project.org/package=tibble
101-
version: '>= 3.0.0'
102-
- type: software
103-
title: tidyr
104-
abstract: 'tidyr: Tidy Messy Data'
105-
notes: Depends
106-
authors:
107-
- family-names: Wickham
108-
given-names: Hadley
109-
email: hadley@rstudio.com
110-
- family-names: Girlich
111-
given-names: Maximilian
112-
year: '2022'
113-
url: https://CRAN.R-project.org/package=tidyr
114-
version: '>= 1.0.0'
11567
- type: software
11668
title: cli
11769
abstract: 'cli: Helpers for Developing Command Line Interfaces'
@@ -146,6 +98,26 @@ references:
14698
email: asrini@pm.me
14799
year: '2022'
148100
url: https://CRAN.R-project.org/package=data.table
101+
- type: software
102+
title: dplyr
103+
abstract: 'dplyr: A Grammar of Data Manipulation'
104+
notes: Imports
105+
authors:
106+
- family-names: Wickham
107+
given-names: Hadley
108+
email: hadley@rstudio.com
109+
orcid: https://orcid.org/0000-0003-4757-117X
110+
- family-names: François
111+
given-names: Romain
112+
orcid: https://orcid.org/0000-0002-2444-4226
113+
- family-names: Henry
114+
given-names: Lionel
115+
- family-names: Müller
116+
given-names: Kirill
117+
orcid: https://orcid.org/0000-0002-1416-3412
118+
year: '2022'
119+
url: https://CRAN.R-project.org/package=dplyr
120+
version: '>= 1.0.0'
149121
- type: software
150122
title: ggplot2
151123
abstract: 'ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics'
@@ -243,6 +215,33 @@ references:
243215
year: '2022'
244216
url: https://CRAN.R-project.org/package=terra
245217
version: '>= 1.5-12'
218+
- type: software
219+
title: tibble
220+
abstract: 'tibble: Simple Data Frames'
221+
notes: Imports
222+
authors:
223+
- family-names: Müller
224+
given-names: Kirill
225+
email: krlmlr+r@mailbox.org
226+
- family-names: Wickham
227+
given-names: Hadley
228+
email: hadley@rstudio.com
229+
year: '2022'
230+
url: https://CRAN.R-project.org/package=tibble
231+
version: '>= 3.0.0'
232+
- type: software
233+
title: tidyr
234+
abstract: 'tidyr: Tidy Messy Data'
235+
notes: Imports
236+
authors:
237+
- family-names: Wickham
238+
given-names: Hadley
239+
email: hadley@rstudio.com
240+
- family-names: Girlich
241+
given-names: Maximilian
242+
year: '2022'
243+
url: https://CRAN.R-project.org/package=tidyr
244+
version: '>= 1.0.0'
246245
- type: software
247246
title: isoband
248247
abstract: 'isoband: Generate Isolines and Isobands from Regularly Spaced Elevation

DESCRIPTION

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: tidyterra
2-
Title: 'tidyverse' Methods and 'ggplot2' Utils for 'terra' Objects
3-
Version: 0.2.2.9000
2+
Title: 'tidyverse' Methods and 'ggplot2' Helpers for 'terra' Objects
3+
Version: 0.3.0
44
Authors@R: c(
55
person("Diego", "Hernangómez", , "diego.hernangomezherrero@gmail.com", role = c("aut", "cre", "cph"),
66
comment = c(ORCID = "0000-0001-8457-4658")),
@@ -18,20 +18,20 @@ URL: https://dieghernan.github.io/tidyterra/,
1818
https://github.com/dieghernan/tidyterra
1919
BugReports: https://github.com/dieghernan/tidyterra/issues
2020
Depends:
21-
dplyr (>= 1.0.0),
22-
R (>= 3.6.0),
23-
tibble (>= 3.0.0),
24-
tidyr (>= 1.0.0)
21+
R (>= 3.6.0)
2522
Imports:
2623
cli (>= 3.0.0),
2724
crayon,
2825
data.table,
26+
dplyr (>= 1.0.0),
2927
ggplot2 (>= 3.1.0),
3028
magrittr,
3129
rlang,
3230
scales,
3331
sf (>= 1.0.0),
34-
terra (>= 1.5-12)
32+
terra (>= 1.5-12),
33+
tibble (>= 3.0.0),
34+
tidyr (>= 1.0.0)
3535
Suggests:
3636
isoband,
3737
knitr,

NAMESPACE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ S3method(transmute,SpatVector)
4141
export("%>%")
4242
export(as_coordinates)
4343
export(as_spatraster)
44+
export(as_tibble)
4445
export(compare_spatrasters)
4546
export(cross_blended.colors)
4647
export(cross_blended.colors2)
48+
export(drop_na)
49+
export(filter)
4750
export(geom_spatraster)
4851
export(geom_spatraster_contour)
4952
export(geom_spatraster_contour_filled)
@@ -54,7 +57,13 @@ export(geom_spatvector_text)
5457
export(hypso.colors)
5558
export(hypso.colors2)
5659
export(is_regular_grid)
60+
export(mutate)
61+
export(pull)
5762
export(pull_crs)
63+
export(relocate)
64+
export(rename)
65+
export(rename_with)
66+
export(replace_na)
5867
export(scale_fill_cross_blended_b)
5968
export(scale_fill_cross_blended_c)
6069
export(scale_fill_cross_blended_d)
@@ -76,10 +85,18 @@ export(scale_fill_whitebox_d)
7685
export(scale_fill_wiki_b)
7786
export(scale_fill_wiki_c)
7887
export(scale_fill_wiki_d)
88+
export(select)
89+
export(slice)
7990
export(slice_colrows)
8091
export(slice_cols)
92+
export(slice_head)
93+
export(slice_max)
94+
export(slice_min)
8195
export(slice_rows)
96+
export(slice_sample)
97+
export(slice_tail)
8298
export(stat_spatraster)
99+
export(transmute)
83100
export(whitebox.colors)
84101
export(wiki.colors)
85102
importFrom(dplyr,everything)

NEWS.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# tidyterra (development version)I
1+
# tidyterra 0.3.0
2+
3+
- Package back to CRAN.
4+
5+
- Libraries **dplyr**, **tidyr**, **tibble** are not attached by default.
6+
Needed functions are reexported instead.
27

38
- Improvements on `geom_spatraster()`:
49

R/as_tibble.Spat.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#'
55
#' `as_tibble()` method for SpatRaster and SpatVector.
66
#'
7-
#' @rdname as_tibble
8-
#' @name as_tibble
7+
#' @rdname as_tibble.Spat
8+
#' @name as_tibble.Spat
99
#'
1010
#' @return
1111
#' A tibble.
@@ -104,7 +104,7 @@ as_tibble.SpatRaster <- function(x, ...,
104104
}
105105

106106
#' @export
107-
#' @rdname as_tibble
107+
#' @rdname as_tibble.Spat
108108
as_tibble.SpatVector <- function(x, ..., .name_repair = "unique") {
109109
df <- tibble::as_tibble(terra::as.data.frame(x, ...),
110110
.name_repair = .name_repair
@@ -188,3 +188,6 @@ make_layer_names <- function(x) {
188188
names(x) <- newnames
189189
return(x)
190190
}
191+
192+
#' @export
193+
tibble::as_tibble

R/drop_na.Spat.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#'
1414
#' @export
1515
#'
16-
#' @rdname drop_na
17-
#' @name drop_na
16+
#' @rdname drop_na.SpatVector
17+
#' @name drop_na.SpatVector
1818
#'
1919
#' @importFrom tidyr drop_na
2020
#'
@@ -189,3 +189,6 @@ drop_na.SpatRaster <- function(data, ...) {
189189

190190
return(newrast)
191191
}
192+
193+
#' @export
194+
tidyr::drop_na

R/filter.Spat.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
#' See **Examples** and section `About layer names` on [as_tibble()].
1313
#'
1414
#' @export
15-
#' @rdname filter
16-
#' @name filter
15+
#' @rdname filter.Spat
16+
#' @name filter.Spat
1717
#'
1818
#' @seealso [dplyr::filter()]
1919
#'
2020
#' @family dplyr.methods
2121
#' @family single table verbs
2222
#'
2323
#' @importFrom dplyr filter
24-
#' @inheritParams select
24+
#' @inheritParams select.Spat
2525
#' @param ... [`data-masking`][dplyr::filter] Expressions that return a logical
2626
#' value, and are defined in terms of the layers/attributes in `.data`. If
2727
#' multiple expressions are included, they are combined with the `&` operator.
@@ -123,7 +123,7 @@ filter.SpatRaster <- function(.data, ..., .preserve = FALSE,
123123
}
124124

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

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

133133
return(terra::vect(filtered))
134134
}
135+
136+
#' @export
137+
dplyr::filter

R/mutate.Spat.R

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
#'
1111
#' @return A Spat* object of the same class than `.data`. See **Methods**.
1212
#'
13-
#' @inheritParams select
13+
#' @inheritParams select.Spat
1414
#' @param ... [`data-masking`][dplyr::mutate] Name-value pairs. The name gives
1515
#' the name of the layer/attribute in the output. See [dplyr::mutate()].
1616
#'
1717
#' @export
18-
#' @rdname mutate
19-
#' @name mutate
18+
#' @rdname mutate.Spat
19+
#' @name mutate.Spat
2020
#'
21-
#' @aliases transmute
21+
#' @aliases transmute.Spat
2222
#'
2323
#' @importFrom dplyr mutate
2424
#'
@@ -114,7 +114,7 @@ mutate.SpatRaster <- function(.data, ...) {
114114
return(final_rast)
115115
}
116116
#' @export
117-
#' @rdname mutate
117+
#' @rdname mutate.Spat
118118
mutate.SpatVector <- function(.data, ...) {
119119

120120
# Use sf method
@@ -124,7 +124,7 @@ mutate.SpatVector <- function(.data, ...) {
124124
return(terra::vect(mutated))
125125
}
126126
#' @export
127-
#' @rdname mutate
127+
#' @rdname mutate.Spat
128128
#' @importFrom dplyr transmute
129129
transmute.SpatRaster <- function(.data, ...) {
130130
df <- as_tbl_spat_attr(.data)
@@ -163,7 +163,7 @@ transmute.SpatRaster <- function(.data, ...) {
163163
return(final_rast)
164164
}
165165
#' @export
166-
#' @rdname mutate
166+
#' @rdname mutate.Spat
167167
transmute.SpatVector <- function(.data, ...) {
168168

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

173173
return(terra::vect(transm))
174174
}
175+
176+
#' @export
177+
dplyr::mutate
178+
179+
#' @export
180+
dplyr::transmute

0 commit comments

Comments
 (0)