library(oce)
# salinity profile (black) with 1-dbar bin means (red)
data(ctd)
plotProfile(ctd, "salinity")
p <- ctd[["pressure"]]
S <- ctd[["salinity"]]
pbreaks <- seq(0, max(p), 1)
binned <- binApply1D(p, S, pbreaks, mean)
lines(binned$result, binned$xmids, lwd = 2, col = rgb(1, 0, 0, 0.9))
Run the code above in your browser using DataLab