# single horizon, constant value
p1 <- data.frame(id = 1, top = 0, bottom = 100, p = 5, name = 'H')
# multiple horizons, constant value
p2 <- data.frame(
id = 2, top = c(0, 10, 20, 30, 40, 50),
bottom = c(10, 20, 30, 40, 50, 100),
p = rep(5, times = 6),
name = c('A1', 'A2', 'Bw', 'Bt1', 'Bt2', 'C')
)
# multiple horizons, random values
p3 <- data.frame(
id = 3, top = c(0, 10, 20, 30, 40, 50),
bottom = c(10, 20, 30, 40, 50, 100),
p = c(1, 5, 10, 35, 6, 2),
name = c('A1', 'A2', 'Bw', 'Bt1', 'Bt2', 'C')
)
# multiple horizons, mostly NA
p4 <- data.frame(
id = 4, top = c(0, 10, 20, 30, 40, 50),
bottom = c(10, 20, 30, 40, 50, 100),
p = c(1, NA, NA, NA, NA, NA),
name = c('A1', 'A2', 'Bw', 'Bt1', 'Bt2', 'C')
)
# shallower version of p1
p5 <- data.frame(id = 5, top = 0, bottom = 50, p = 5, name = 'H')
# combine and upgrade to SPC
z <- rbind(p1, p2, p3, p4, p5)
depths(z) <- id ~ top + bottom
hzdesgnname(z) <- 'name'
z <- fillHzGaps(z)
# visual check
par(mar = c(1, 0, 3, 3))
plotSPC(z, color = 'p', name.style = 'center-center', cex.names = 0.8, max.depth = 110)
# factor version of horizon name
z$fname <- factor(z$name)
vars <- c('p', 'name')
# result is total bytes
pi <- profileInformationIndex(z, vars = vars, method = 'joint', baseline = FALSE)
text(x = 1:5, y = 105, labels = pi, cex = 0.85)
mtext('Profile Information Index (bytes)', side = 1, line = -1)
Run the code above in your browser using DataLab