Skip to content

Commit

Permalink
min change in occfilt_geo
Browse files Browse the repository at this point in the history
  • Loading branch information
sjevelazco committed Feb 19, 2024
1 parent 552311c commit 3de2872
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Description: Assist in the construction of flexible species distribution workflo
License: GPL (>= 3)
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Suggests:
covr,
knitr,
Expand Down
12 changes: 6 additions & 6 deletions R/occfilt_geo.R
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ occfilt_geo <- function(data, x, y, env_layer, method, prj = "+proj=longlat +dat
if (sum(!filt) > 0) {
message(sum(!filt), " records were removed because they have NAs for some variables")
da <- da[filt, ]
data0 <- data0[filt, ]
coord <- coord[filt, ]
env <- env[filt, ]
}
Expand Down Expand Up @@ -234,6 +235,7 @@ occfilt_geo <- function(data, x, y, env_layer, method, prj = "+proj=longlat +dat
}) == max(sapply(occT, function(x) {
nrow(x)
})))[1]]]
colnames(occT) <- c(x, y)
occT <- as.integer(row.names(occT))

# Select Thinned Occurrences
Expand Down Expand Up @@ -299,15 +301,13 @@ occfilt_geo <- function(data, x, y, env_layer, method, prj = "+proj=longlat +dat
)
))
occT <-
occT[[which(sapply(occT, function(x) {
nrow(x)
}) == max(sapply(occT, function(x) {
occT[[which.max(sapply(occT, function(x) {
nrow(x)
})))[1]]]
occT <- as.integer(row.names(occT))
}))[1]]]
colnames(occT) <- c(x, y)

# Select Thinned Occurrences
coord_filter <- data0[occT, ]
coord_filter <- data0[which(data0[,x]%in%occT[,x] & data0[,y]%in%occT[,y]), ]
message("Distance threshold(km): ", round(as.numeric(method["d"]), 3))
message("Number of filtered records: ", nrow(coord_filter))
}
Expand Down

0 comments on commit 3de2872

Please sign in to comment.