Skip to content

Commit

Permalink
Your voice is so soothing
Browse files Browse the repository at this point in the history
  • Loading branch information
geryan committed Aug 9, 2024
1 parent 31a6b50 commit 151be2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/mask_from_all.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' (b) returns a mask layer, rather than masking each layer in `r`
#'
#'
#' @param r
#' @param r `SpatRaster` with >1 layer.
#'
#' @return `SpatRaster` with values `NA` or 1.
#' @export
Expand All @@ -29,15 +29,15 @@
#'
mask_from_all <- function(r){

j <- nlyr(r)
j <- terra::nlyr(r)

if(j == 1){stop("Must have >1 layer")}

k <- which(is.na(values(r[[1]])))
k <- which(is.na(terra::values(r[[1]])))

for(i in 2:j){

a <- which(is.na(values(r[[i]])))
a <- which(is.na(terra::values(r[[i]])))

b <- c(k, a)

Expand Down
2 changes: 1 addition & 1 deletion man/mask_from_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 151be2f

Please sign in to comment.