[R] Need Help
Petr PIKAL
petr.pikal at precheza.cz
Fri Nov 18 09:27:00 CET 2011
> Hi,
> 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
working.
> Can you please give me a solution.
>
> gl1<- subset(grassland[,5:44], colSums > 0.05, select=2)
Hm. How did you got this code?
By
grassland[,5:44]
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.
Regards
Petr
>
> gl1 is my new matrix ,and grassland[,5:44] is my original matrix.
>
> thanks,
> Dilshan
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list