This is probably the long way around to do it but im not sure how to shorten it. In the data frame below (df3), I have 2 sites where the depth ranges from 0.1 to 15.1 in 0.1 intervals. The density changes from surface to deep ocean but I need to find where the density increases by 0.03 after a depth of 10m for each site. Is there a way to find that depth by site?
depth <- seq(from = 0.1, to =15.1, by = 0.1)
density <- c(NA, NA, NA, NA, NA, 1027.073188, 1027.073543, 1027.073898, 1027.074253, 1027.074607, 1027.074962, 1027.075317, 1027.075672, 1027.076026, 1027.076381, 1027.076736, 1027.077118, 1027.077501, 1027.077884, 1027.078267, 1027.078649, 1027.079032, 1027.079415, 1027.079797, 1027.08018, 1027.080563, 1027.081026, 1027.081489, 1027.081952, 1027.082415, 1027.082878, 1027.08334, 1027.083803, 1027.084266, 1027.084729, 1027.085192, 1027.085663, 1027.086134, 1027.086605, 1027.087076, 1027.087547, 1027.088018, 1027.088489, 1027.08896, 1027.089431, 1027.089909, 1027.090387, 1027.090865, 1027.091344, 1027.091822, 1027.0923, 1027.092778, 1027.093256, 1027.093735, 1027.094213, 1027.094691, 1027.095162, 1027.095633, 1027.096104, 1027.096575, 1027.097046, 1027.097517, 1027.097987, 1027.098458, 1027.098929, 1027.0994, 1027.099871, 1027.100342, 1027.100813, 1027.101284, 1027.101755, 1027.102226, 1027.102697, 1027.103167, 1027.103638, 1027.104109, 1027.104556, 1027.105003, 1027.10545, 1027.105897, 1027.106344, 1027.106791, 1027.107237, 1027.107684, 1027.108131, 1027.108578, 1027.109041, 1027.109504, 1027.109967, 1027.110429, 1027.110892, 1027.111355, 1027.111818, 1027.112281, 1027.112744, 1027.113207, 1027.113683, 1027.114159, 1027.114635, 1027.115112, 1027.115588, 1027.116065, 1027.116542, 1027.117019, 1027.117497, 1027.117974, 1027.118451, 1027.118928, 1027.119406, 1027.119883, 1027.12036, 1027.120836, 1027.121312, 1027.121788, 1027.122264, 1027.12274, 1027.123216, 1027.123692, 1027.124167, 1027.124643, 1027.125119, 1027.125595, 1027.126071, 1027.126547, 1027.127023, 1027.127499, 1027.127975, 1027.128451, 1027.128926, 1027.129402, 1027.129878, 1027.130354, 1027.13083, 1027.131305, 1027.131781, 1027.132257, 1027.132732, 1027.133208, 1027.133684, 1027.134159, 1027.134635, 1027.135111, 1027.135587, 1027.136062, 1027.136538, 1027.137014, 1027.137489, 1027.137965, 1027.138441, 1027.138916, 1027.139392)
df <- as.data.frame(cbind(depth, density))
df$site <- 1
df2 <- as.data.frame(cbind(depth, density-0.015))
df2$site <- 2
colnames(df2)[2] <- "density"
df3 <- rbind(df, df2)