# need this
library(aqp)
# generate 10 random profiles with default settings:
d <- ldply(1:10, random_profile)
# add a fake color
d$soil_color <- 'white'
# convert to SoilProfileList object and plot
d <- initProfileList(d)
profile_plot(d)
# if the plotrix package is installed,
# make a more interesting color based on the first property
if(require(plotrix))
{
d <- ldply(1:10, random_profile)
d$soil_color <- color.scale(d$p1, c(0,1,1),c(1,1,0),0)
d <- initProfileList(d)
profile_plot(d)
}
#
# simple cluster analysis:
d <- ldply(1:10, random_profile)
p <- profile_compare(d, vars=c('p1','p2','p3'), max_d=50, k=0)
plot(hclust(p))
# stress-test profile comparison functions (not run)
# d <- ldply(1:1000, random_profile)
#
# 100 profiles, 4 varibales:
# 66 seconds on 1.3 Ghz Intel Mac Mini
# D matrix = 192.3 Mb
# 768 Mb required
# p <- profile_compare(d, vars=c('p1','p2','p3','p4','p5'), max_d=50, k=0)
# more efficient computation, at the expense of precision, with
# p <- profile_compare(d, vars=c('p1','p2','p3','p4','p5'),
# max_d=50, k=0, sample_interval=10)
Run the code above in your browser using DataLab