data(sp4)
depths(sp4) <- id ~ top + bottom
# introduce depth logic errors
idx <- c(2, 6:7, 8, 12)
sp4$top[idx] <- NA
# check
horizons(sp4)[idx, ]
# create gaps by removing logic errors
x <- HzDepthLogicSubset(sp4, byhz = TRUE)
# check on removed horizons (hzID values)
metadata(x)$removed.horizons
# inspect
par(mar = c(0, 0, 0, 2))
plotSPC(x, width = 0.3, default.color = 'royalblue',
name = 'hzID', name.style = 'center-center', cex.names = 0.8,
cex.id = 0.66)
# fill gaps left by HzDepthLogicSubset()
z <- fillHzGaps(x, flag = TRUE)
# graphical check
plotSPC(z, width = 0.3, color = '.filledGap', name = 'hzID',
show.legend = FALSE, name.style = 'center-center', cex.names = 0.8,
cex.id = 0.66)
# fill top to 0 cm
z2 <- fillHzGaps(x, flag = TRUE, to_top = 0)
plotSPC(z2, width = 0.3, color = '.filledGap', name = 'hzID', show.legend = FALSE)
# fill bottom to max(SPC)
z3 <- fillHzGaps(x, flag = TRUE, to_top = 0, to_bottom = max(x))
plotSPC(z3, width = 0.3, color = '.filledGap', name = 'hzID', show.legend = FALSE)
## another example
data(sp4)
depths(sp4) <- id ~ top + bottom
# remove 1st horizons from profiles 1:4
idx <- sp4[,, .FIRST, .HZID]
replaceHorizons(sp4) <- horizons(sp4)[-idx[1:4], ]
# prepare for dice()
z <- fillHzGaps(sp4, to_top = 0, to_bottom = 50, flag = TRUE)
# empty-horizon padding is in place for formula interface to dice()
d <- dice(z, fm = 0:50 ~ .)
plotSPC(d, color = 'Ca', show.legend = FALSE)
plotSPC(d, color = '.filledGap', show.legend = FALSE)
Run the code above in your browser using DataLab