Skip to content

Commit 7ce79ad

Browse files
new error messages and lintr corrections
1 parent 9a8ab16 commit 7ce79ad

File tree

135 files changed

+1599
-1658
lines changed

Some content is hidden

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

135 files changed

+1599
-1658
lines changed

DESCRIPTION

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Collate:
157157
'api_s2tile.R'
158158
'api_samples.R'
159159
'api_segments.R'
160+
'api_select.R'
160161
'api_sf.R'
161162
'api_shp.R'
162163
'api_signal.R'

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ S3method(summary,sits_accuracy)
397397
S3method(summary,sits_area_accuracy)
398398
export("sits_bands<-")
399399
export("sits_labels<-")
400+
export(.mpc_clean_token_cache)
401+
export(.plot_false_color)
400402
export(impute_linear)
401403
export(sits_accuracy)
402404
export(sits_accuracy_summary)

R/api_accessors.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
paste0("EPSG:", .compact(x))
126126
}
127127
} else {
128-
stop("invalid crs value")
128+
stop("invalid crs value")
129129
}
130130
}
131131
#' @title Return CRS from a spatial data structure

R/api_accuracy.R

+6-7
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#' @return A tibble with predicted and reference values.
1212
.accuracy_pred_ref <- function(class) {
1313
# retrieve the predicted values
14-
pred <- unlist(purrr::map(class$predicted, function(r) r$class))
14+
pred <- unlist(purrr::map(class[["predicted"]], function(r) r[["class"]]))
1515
# retrieve the reference labels
16-
ref <- class$label
16+
ref <- class[["label"]]
1717
# does the input data contains valid reference labels?
1818
.check_labels(ref)
1919
# build the tibble
@@ -52,11 +52,10 @@
5252
# are in the validation file
5353
diff_classes <- setdiff(rownames(error_matrix), names(area))
5454
if (length(diff_classes) > 0 &&
55-
length(diff_classes) < length(rownames(error_matrix))) {
56-
warning(
57-
paste("The classified cube does not have all the classes in the",
58-
"validation file."),
59-
call. = FALSE
55+
length(diff_classes) < length(rownames(error_matrix))) {
56+
warning("The classified cube does not have all the classes in the",
57+
" validation file.",
58+
call. = FALSE
6059
)
6160
# Create a numeric vector with zeros
6261
vec_areas <- rep(0, length(diff_classes))

R/api_apply.R

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#' @return Tibble where function has been applied.
1111
.apply <- function(data, col, fn, ...) {
1212
# pre-condition
13-
.check_chr_within(col,
13+
.check_chr_within(
14+
col,
1415
within = names(data),
1516
msg = "invalid column name"
1617
)
@@ -213,15 +214,15 @@
213214
.apply_capture_expression <- function(...) {
214215
# Capture dots as a list of quoted expressions
215216
list_expr <- lapply(substitute(list(...), env = environment()),
216-
unlist,
217-
recursive = FALSE
217+
unlist,
218+
recursive = FALSE
218219
)[-1]
219220

220221
# Check bands names from expression
221222
.check_expression(list_expr)
222223

223224
# Get out band
224-
out_band <- toupper(gsub("_", "-", names(list_expr)))
225+
out_band <- toupper(gsub("_", "-", names(list_expr), fixed = TRUE))
225226
names(list_expr) <- out_band
226227

227228
return(list_expr)

R/api_band.R

+9-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
.band_rename.sits <- function(x, bands) {
1818
data_bands <- sits_bands(x)
1919
# pre-condition
20-
.check_chr(bands,
20+
.check_chr(
21+
bands,
2122
allow_empty = FALSE, len_min = length(data_bands),
2223
len_max = length(data_bands)
2324
)
@@ -43,7 +44,8 @@
4344
.band_rename.raster_cube <- function(x, bands) {
4445
data_bands <- sits_bands(x)
4546
# pre-condition
46-
.check_chr(bands,
47+
.check_chr(
48+
bands,
4749
allow_empty = FALSE,
4850
len_min = length(data_bands),
4951
len_max = length(data_bands)
@@ -62,12 +64,12 @@
6264
new_bands[data_bands] <- toupper(bands)
6365
colnames(x) <- unname(new_bands)
6466

65-
x <- tidyr::pivot_longer(x,
67+
x <- tidyr::pivot_longer(
68+
x,
6669
cols = toupper(bands),
6770
names_to = "band",
6871
values_to = "path"
6972
)
70-
7173
return(x)
7274
})
7375
}
@@ -84,23 +86,23 @@
8486
#' @param band band name (may be lower or upper case)
8587
#' @return band name in upper case
8688
.band_eo <- function(band) {
87-
gsub("_", "-", toupper(band))
89+
gsub("_", "-", toupper(band), fixed = TRUE)
8890
}
8991
#' @title Convert band names for derived cubes
9092
#' @name .band_derived
9193
#' @noRd
9294
#' @param band band name (may be lower or upper case)
9395
#' @return band name in lower case
9496
.band_derived <- function(band) {
95-
gsub("_", "-", tolower(band))
97+
gsub("_", "-", tolower(band), fixed = TRUE)
9698
}
9799
#' @title Convert band names for time series
98100
#' @name .band_samples
99101
#' @noRd
100102
#' @param band band name (may be lower or upper case)
101103
#' @return band name in upper case
102104
.band_samples <- function(band) {
103-
gsub("_", "-", toupper(band))
105+
gsub("_", "-", toupper(band), fixed = TRUE)
104106
}
105107
#' @title Convert band names for data cube
106108
#' @name .band_set_case

R/api_bbox.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#'
1212
.bbox_equal <- function(bbox1, bbox2, tolerance = 0) {
1313
.is_eq(unlist(bbox1[.bbox_cols]), unlist(bbox2[.bbox_cols]),
14-
tolerance = tolerance
14+
tolerance = tolerance
1515
)
1616
}
1717
#' @title Bounding box API
@@ -74,7 +74,7 @@ NULL
7474
#' @returns One of the arguments passed in `...` according to a bbox type.
7575
.bbox_switch <- function(x, ...) {
7676
switch(.bbox_type(x),
77-
...
77+
...
7878
)
7979
}
8080
#' @title Extract a bbox
@@ -233,6 +233,6 @@ NULL
233233
# Convert WKT to sf CRS object
234234
crs_sf <- sf::st_crs(wkt_crs)
235235
# Convert sf CRS object to PROJ4 string
236-
proj4string <- crs_sf$proj4string
236+
proj4string <- crs_sf[["proj4string"]]
237237
return(proj4string)
238238
}

0 commit comments

Comments
 (0)