# NOT RUN {
##define deposition rate and stratigraphic pattern
binborder=1:6 #bins in tratigraphic height
depoval=c(1,4,0.1,2,2)
usedunit="sediment per time" #unit of deposition rate is sediment per time unit (default setting)
#Plot deposition rate
plot(approx(binborder,c(depoval,tail(depoval,1)),method='constant',
xout=seq(min(binborder),max(binborder),length.out=100)),type='l',main='Deposition Rate',
xlab='Stratigraphic Height',ylab=usedunit,ylim=c(0,max(depoval)))
#define stratigraphic rate
signalval=c(runif(5))
#plot stratigraphic pattern
plot(approx(binborder,c(signalval,tail(signalval,1)),method='constant',
xout=seq(min(binborder),max(binborder),length.out=100)),type='l',main='Deposition Rate',
xlab='Stratigraphic Height', ylab='Stratigraphic Pattern',ylim=c(0,max(signalval)))
##transform stratigraphic pattern into temporal pattern
usedunit="sediment per time" #unit of deposition rate is sediment per time unit (default setting)
reslist=strattotimeratebin(binborder,depoval, signalval,unit=usedunit)
#plot results
plot(reslist$age,reslist$val,xlab='time',ylab='temporal pattern',
main=paste('depoval interpreted as',usedunit))
usedunit="time per sediment" #use other input interpretation
reslist=strattotimeratebin(binborder,depoval, signalval,unit=usedunit)
#note how different the results look!!
plot(reslist$age,reslist$val,xlab='time',ylab='temporal pattern',
main=paste('depoval interpreted as',usedunit))
##insert a hiatus
stratigraphicheight=3.5 #strat. height of the hiatus
duration=2 #duration of the hiatus
hiatuslist=list(c(stratigraphicheight,duration)) #required input format for hiatuses
#usedunit is back to default setting!
reslist=strattotimeratebin(binborder,depoval, signalval,hiatuslist=hiatuslist)
#the hiatus corresponds to the gap in the middle of the temporal rate
plot(reslist$age,reslist$val,xlab='time',ylab='temporal pattern')
# }
Run the code above in your browser using DataLab