Skip to content

Commit 76462fd

Browse files
authored
Merge pull request #2188 from MichaelChirico/vector-logic
Use scalar logical operators where appropriate
2 parents 3362108 + b978e47 commit 76462fd

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

R/break_antimeridian.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#' }
3232
st_break_antimeridian = function(x, lon_0=0, tol=0.0001, ...) {
3333
ll = st_is_longlat(x)
34-
if (!ll | is.na(ll))
34+
if (!isTRUE(ll))
3535
stop("'st_break_antimeridian' requires non-projected geographic coordinates",
3636
call. = FALSE)
3737

R/db.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ db_find_srid = function(conn, crs_local = st_crs(srid), srid = epsg(crs_local),
242242
}
243243
crs_found <- st_crs(db_crs[["srtext"]])
244244
crs_found[["input"]] <- build_epsg(srid)
245-
if(validate && crs_found != crs_local & !is.na(crs_local)) {
245+
if(validate && crs_found != crs_local && !is.na(crs_local)) {
246246
# TODO: pretty print db_spatial_ref
247247
warning("Local crs different from database crs. You can inspect the ",
248248
"database crs using `dbReadtable(conn, \"spatial_ref_sys\")` ",

R/sample.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ st_sample.sfc = function(x, size, ..., type = "random", exact = TRUE, warn_if_no
119119
st_multipoints_sample(do.call(c, x), size = size, ..., type = type),
120120
st_ll_sample(st_cast(x, "LINESTRING"), size = size, ..., type = type),
121121
st_poly_sample(x, size = size, ..., type = type, by_polygon = by_polygon))
122-
if (exact & type == "random" & all(st_geometry_type(res) == "POINT")) {
122+
if (exact && type == "random" && all(st_geometry_type(res) == "POINT")) {
123123
diff = size - length(res)
124124
if (diff > 0) { # too few points
125125
res_additional = st_sample_exact(x = x, size = diff, ...,

R/sf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ st_sf = function(..., agr = NA_agr_, row.names,
265265
x
266266
else if (length(x) == 1) # ONLY one sfc
267267
data.frame(row.names = row.names)
268-
else if (!sfc_last & inherits(x, "data.frame"))
268+
else if (!sfc_last && inherits(x, "data.frame"))
269269
x
270270
else if (sfc_last && inherits(x, "data.frame"))
271271
x[-all_sfc_columns]

R/shift_longitude.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' @export
1616
st_shift_longitude = function(x) {
1717
ll = st_is_longlat(x)
18-
if (!ll | is.na(ll))
18+
if (!isTRUE(ll))
1919
stop("'st_shift_longitude' requires non-projected geographic coordinates",
2020
call. = FALSE)
2121

0 commit comments

Comments
 (0)