Learn R Programming

aqp (version 0.99-8.1)

random_profile: Random Profile

Description

Generate a random soil profile according to set criteria, with correlated depth trends.

Usage

random_profile(id, n = c(3, 4, 5, 6), min_thick = 5,
 max_thick = 30, n_prop = 5, exact = FALSE)

Arguments

id
a character or numeric id used for this profile
n
vector of possible number of horizons, or the exact number of horizons (see below)
min_thick
minimum thickness criteria for a simulated horizon
max_thick
maximum thickness criteria for a simulated horizon
n_prop
number of simulated soil properties (columns in the returned dataframe)
exact
should the exact number of requested horizons be generated? (defaults to FALSE)

Value

  • A dataframe with the simulated profile.

References

http://casoilresource.lawr.ucdavis.edu/

See Also

profile_compare

Examples

Run this code
# 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