# First dive to 25 m for 20 min with safety stop
  d1 <- dive(c(25,20),c(5,5))
  # Evaluate saturation according to DSAT model
  s1 <- haldane(d1)
  # Look at saturation (in ata)
  barplot(s1)
  # Look at saturation (in \% of maximum)
  data(Mvalues)
  barplot(100 * s1/Mvalues$ata$DSAT, ylab="Relative saturation", xlab="Tissues")
  # Evaluate saturation after 2 hour surface interval
  s2 <- haldane(dive(c(0,120)), prevstate=s1)
  # Then after another dive to 18 m for 30 min with safety stop
  s3 <- haldane(dive(c(18, 30),c(5,3)), prevstate=s2)
  # Assess effect of breathing 80\% oxygen at safety stop
  s3o <- haldane(dive(c(18, 30),5, nitrox(0.8), c(5,3)), prevstate=s2)Run the code above in your browser using DataLab