I have a table of species combinations that overlap geographically.
Sp_a Sp_b prop_overlap
Cat Dog 1
But I want to create a matrix that looks like this:
Cat
Dog 1
I have approximately 180000 combinations. Is there any quick way of converting this information in R?
I have tried:
m <- matrix( NA, ncol = max(species_int$sp_a) , nrow = max(species_int$sp_b) )
m[ cbind( species_int$sp_b , species_int$sp_a ) ] <- species_int$prop_overlap
Thanks