Macintosh; Intel Mac OS X 12_4_0
Hi, I have two files, one named mint_04_export and one named maxt_04_export:
> dput(mint_04_export)
structure(list(CodeNidif = c("A08B08_200801", "A08E31_201501",
"A09A03_200901", "A12B01_201301"), Altitude = c(296, 278, 301,
296),091-095
= c(-9.82, -9.73, -9.84, -9.82),096-100
= c(-9.78,
-9.75, -9.82, -9.78),101-105
= c(-6.96, -6.9, -6.99, -6.96
)), row.names = c(NA, 4L), class = "data.frame")
> dput(maxt_04_export)
structure(list(CodeNidif = c("A08B08_200801", "A08E31_201501",
"A09A03_200901", "A12B01_201301"), Altitude = c(296, 278, 301,
296), 091-095
= c(1.71, 1.78, 1.68, 1.71), 096-100
= c(1.17,
1.26, 1.13, 1.17), 101-105
= c(5.52, 5.59, 5.48, 5.52)), row.names = c(NA,
4L), class = "data.frame")
I want to create a table where I would keep the first columns : CodeNifid and Altitude, but would like to get the mean of the columns of the same name. E.g.
the value of 091-095 of the row of A08B08_200801 from both both tables mint_04_export and maxt_04_export.
I am not able to do this, here is what I tried (by joining the two files together):
> combin_04<-mint_04 %>%
> left_join(maxt_04, by='CodeNidif')
>
> moyt_04<-mint_04 %>%
> left_join(maxt_04, by='CodeNidif') %>%
> group_by(CodeNidif) %>%
> summarize(moyt=mean(`091-095.x`,`091-095.y`))