[R] Subsetting a square marix

Sarah Goslee sarah.goslee at gmail.com
Tue Jan 5 17:15:19 CET 2016


It really isn't clear what you want, and posting in HTML has mangled
what you did provide.

Please use dput() to provide sample data, and give us a clear idea of
what you want, ideally an example of what the output should look like.
Adding the R code you've tried to use is also a good idea.

Sarah

On Tue, Jan 5, 2016 at 4:06 AM, Tawanda Tarakini
<tawandatizora at gmail.com> wrote:
> I have a global matrix (e.g. table below) of species feeding. I am trying
> to create specific matrix for specific sites. If for example a subset is to
> have sp1, sp3 and spp only these 3 species should be appearing in the
> subset (both column and rows).
>
> I have been checking online help but I seem not to get my scenario
>
>
>
> Sp1
>
> Sp2
>
> Sp3
>
> Sp4
>
> Sp5
>
> Sp6
>
> Sp1
>
> 0
>
> 0
>
> 1
>
> 0
>
> 0
>
> 0
>
> Sp2
>
> 1
>
> 0
>
> 0
>
> 0
>
> 1
>
> 0
>
> Sp3
>
> 0
>
> 0
>
> 0
>
> 1
>
> 0
>
> 0
>
> Sp4
>
> 0
>
> 1
>
> 0
>
> 1
>
> 0
>
> 0
>
> Sp5
>
> 0
>
> 0
>
> 1
>
> 0
>
> 0
>
> 0
>
> Sp6
>
> 0
>
> 0
>
> 0
>
> 1
>
> 1
>
> 0
>
> --
> Kind Regards
>
> Tawanda Tarakini
>
> Lecturer and Industrial attachment coordinator
> Department of Wildlife, Ecology and Conservation
> Chinhoyi University of Technology
> Bag 7724, Chinhoyi
> Cell: +263 775 321 722
> Alternative email: ttarakini at cut.ac.zw
>
>         [[alternative HTML version deleted]]
>


-- 
Sarah Goslee
http://www.numberwright.com



More information about the R-help mailing list