[R] row sum with all absence in a presence-absence matrix

Jim Lemon jim at bitwrit.com.au
Tue Oct 8 13:37:23 CEST 2013


On 10/08/2013 10:21 PM, Elaine Kuo wrote:
> Dear list
>
>
>
> I have a matrix composed of islandID as rows and speciesID as columns.
>
> IslandID: Island A, B, C….O (15 islands in total)
>
> SpeciesID: D0001, D0002, D0003….D0100 (100 species in total)
>
>
>
> The cell of the matrix describes presence (1) or absence (0) of the species
> in an island.
>
>
>
> Now I would like to search how many species are found in (1, presence) for
> Island A, Island D, and Island L respectively.
>
>
>
> Please kindly advise the R code for the search purpose.
>
Hi Elaine,
Sounds like "rowSums" to me.

Jim



More information about the R-help mailing list