Hi all,
Hello,
I have a df like this where for the same station I have values of environmental variables at different depths.
Here for station A1, I have values and 1 to 4m,
For A2, from 1 to 6m.
What I would like is to have the average of these environmental values for the strat [1-4m] for A1 and [1-6m] for A2.
Basically have a single line per station where I have the average of my environmental variables
df <- tribble(
~station, ~depth, ~Temp, ~Sal, ~PProd,
"A1",1, 2.5, -0.65, -0.23
"A1",2, 2.8, -0.57, -0.28
"A1",3, 2.6, -0.28, -0.25
"A1",4, 2.6, -0.15, -0.21
"A2",1, 2.48, -0.58, -0.29
"A2",2, 2.54, -0.47, -0.26
"A2",3, 2.8, -0.35, -0.21
"A2",4, 2.74, -0.31, -0.18
"A2",5, 3.05, -0.30, -0.16
"A2",6, 3.18, -0.27, -0.15
Thanks !