search for: sppmax

Displaying 1 result from an estimated 1 matches for "sppmax".

Did you mean: sp_max
2012 Jul 11
3
Subset based on multiple values
...ata by several numbers and it cuts out half of the rows. Here is the sample code: test <- as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count <- tapply(test[,1], test[,1], length) # count for each value spp <- unique(test[,1]) Count1 <- as.data.frame(cbind(Count,spp)) Max <- max(Count) Count1$sppMax <- ifelse(Count1$Count >= Max, Count1$spp, 0) # only keep values that =Max Count2 <- subset(Count1, sppMax > 0) #get rid of values that are less than Max AllMax <- unique(Count2$sppMax) test2 <- subset(test, test[,1] == AllMax) this works where there is only one value for Al...