temperature mean on absence presence data

Hello, i'm beginner on Rstudio, i need i need help for a report.
I Have one data with temperature associate to the longitude and latitude. My seconde data is more than 600 species of fish, wich is encoded by 0= absence and 1= presence. And i would like to get a new column with the mean temperature for each species. Knowing that the presence absence is linked to the longitude, latitude data.

I hope somebody can help me.

best wishes

[image]

You could study how to transform data


Particularly chapter 5

thank you i will do it !