Skip to content

Commit

Permalink
glom: fix edge case for #180 (comment)
Browse files Browse the repository at this point in the history
- failed to insert filled horizons when specified interval intersected no horizons
  • Loading branch information
brownag committed May 31, 2024
1 parent 4c18300 commit f25246d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/glom.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,20 @@ setMethod("glom", signature(p = "SoilProfileCollection"),
p <- .updateSite(p, h)
}

if (nrow(h) > 0) {
if (!fill) {
if (fill) {
p <- .insert_dropped_horizons(p, horizons = h)
} else {
if (nrow(h) > 0) {
# replace @horizons with h
replaceHorizons(p) <- h

# if pre-existing "filled" horizons are present, drop them
p <- p[!isEmpty(p),]
} else {
p <- .insert_dropped_horizons(p, horizons = h)
p <- p[0, ]
}
} else {
p <- p[0,]
}

# short circuit to get hzIDs of result
if (ids) {
if (invert)
Expand Down

0 comments on commit f25246d

Please sign in to comment.