jeudi 2 avril 2020

R doesn't recognize character elements of vector as same thing

I have a vector of 216 character elements (scientific names of species, 36 species in total, 6 repetitions for each). From this vector I'd like to draw a random sample of 24 unique species. However, I can't figure out how to tell R that I don't want a single species to be repeated within a sample, since R sees each of the 216 elements as unique values, even if there are 36 groups of 6 identical elements. This example is a bit simplified, I know I can do the sampling of 24 from the initial 36 unique values, but I need a solution for the above-mentioned issue because I have to do 9 consecutive samplings of 24 species from the initial 216 elements.

Any help would be appreciated!!




Aucun commentaire:

Enregistrer un commentaire