Dear friends,


I have a question do not know how to resolve.


I have a big matrix composed of different columns (I use N here). A column is "species" and another one is "latitudes". Now, I want to know how I can get the number of different "latitudes" for every "species". I have tried to split the matrix according to species (X<-split(N, N$species) and then use sapply(X, function(m){nlevels(m$latitudes)}) to get that. But the result shows the total factor numbers of "latitudes" but not the factor numbers of every species I splitted. Also, I have tried to use tapply(N$latitudes, N$species, nlevels) to do this. The result is the same. I am confused about this. Can someone help me with that? Thank you very much!


Best regards,
Yichun






	[[alternative HTML version deleted]]

