[R] Need Help
petr.pikal at precheza.cz
Fri Nov 18 09:27:00 CET 2011
> I need to make a subset of my species abundance matrix with only species
> (columns) that have a total abundance(column sum) greater than 0.5 to do
> ordination in vegan package. I used following code but it is not
> Can you please give me a solution.
> gl1<- subset(grassland[,5:44], colSums > 0.05, select=2)
Hm. How did you got this code?
you limit subset to only columns 5:44
function colSums does not know what to sum
by select=2 you are choosing only column 2.
So it is rather weird collection of commands.
grassland[, colSums(grassland) > 0.05]
selects all columns for which their sum is over 0.05. What you want to do
next is up to you.
> gl1 is my new matrix ,and grassland[,5:44] is my original matrix.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help