# NOT RUN {
data(Nelson)
# Remove Depth and Corrugated and compute percentages
Nelson.pct <- prop.table(as.matrix(Nelson[,3:7]), 1)*100
# Percentages for each type by level
round(Nelson.pct, 2)
# Battleship plot from plotrix package
if (requireNamespace("plotrix", quietly = TRUE)) {
plotrix::battleship.plot(Nelson.pct, col="gray")
} else {
cat("This example requires package plotrix.\n")
}
# }
Run the code above in your browser using DataLab