I have a big dataframe with info of which site the data is from, a name, a code and then a empty row and then data.
Site Site1 Site1 Site1 Site1 Site2 Site2
Name A B C D E F
Code A12 A41 A32 A33 A21 A12
- 3.2 4.2 5.2 3.1 1.11 2.52
- 9.2 0.21 3.12 3.03 2.12 5.12
....
So what I try to do is to find all values which have the same value in the "Code" row and either extract them to a seperat dataframe to then calculated the correlation or just calculated the correlation between them right there.
In the end I want something like:
SiteA SiteB Correlation NameA NameB
Site1 Site2 .87 A12 A12
Site4 Site8 .76 B32 B32
I dont know before hand how many sites I will have but Im only intressed in the correlation when the code is the same.
I tried to extract the info (the first 3 rows) in a seperated data frame and tried to put every site in its own dataframe but wasn't able to do so.
dputto share your data as a reproducible example.