1
Well, I’d like some help, I have these data each column has 100%, first wanted to index from the largest to the smallest and later make use of the dummy variable of value equal to 1 for the species that add up 50%, the rest would be of value equal to zero.
Nome Dens Freq Dom
1 Abarema 9.090909 46.153846 29.411765
2 Abuta 13.636364 11.538462 23.529412
3 Agonandra 18.181818 7.692308 11.764706
4 Aiouea 22.727273 15.384615 29.411765
5 Alchorneopsis 36.363636 19.230769 5.882353
Upshot:
Nome Dens Freq Dom v1 v2 v3
1 Abarema 9.090909 46.153846 29.411765 0 1 1
2 Abuta 13.636364 11.538462 23.529412 0 0 0
3 Agonandra 18.181818 7.692308 11.764706 0 0 0
4 Aiouea 22.727273 15.384615 29.411765 1 0 1
5 Alchorneopsis 36.363636 19.230769 5.882353 1 1 0
If you could help me, I’d be grateful.
Hello André, welcome to Stackoverflow PT, first I would like to ask you a more detailed explanation of your problem, because it is a little confused and so difficult to understand. Second, it would be pretty cool if you could put a little bit of what you’ve been able to do so far, because then the community can see that it’s a problem that you’re struggling to solve, and that it’s not a case where you’re asking something without at least trying.
– Um Programador
Of a
dput
in your data as it becomes easier to work on the code with the same database you have.– Flavio Silva
How do you calculate "the species totalling 50%"? Adding up the values from the highest to 50%? In your example this is what you seem to have done.
– Rui Barradas
Thank you very much for the guidelines, it was the first post I made. The example below worked perfectly.
– André