[R] how to remove the redundant rows of a matrix

R. Michael Weylandt michael.weylandt at gmail.com
Mon Oct 31 21:14:31 CET 2011


Your data didn't come through with the html stripping but either
unique() or duplicated() should get you where you need to be.

Michael

On Mon, Oct 31, 2011 at 12:25 PM, yan liu <yanliusun at gmail.com> wrote:
> Hi,
>
> I have a matrix like this, two columns: a, b
>
>  a b  c1 21  c2 19  c2 20  c2 20  c4 25  c5 18  c5 18
> how to prepare a new matrix removing the rows with repeated units in b
> columns, like there are two 20 and two 18 in b column (others are unique in
> b col).  I wanna a pure matrix with one 20 and one 18.
>
> Thanks a lot!
>
> Yan
>
>        [[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