[R] R: Deleting repeated rows

Guazzetti Stefano Stefano.Guazzetti at ausl.re.it
Fri Jun 26 18:48:06 CEST 2009


?unique
as an example
> mat<-matrix(c(1,2,3,1,1,2,1,2,3,4,7,5), ncol=3, byrow=T)
> mat #rows 1 and 3 are identical
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    1    1    2
[3,]    1    2    3
[4,]    4    7    5

> unique(mat)
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    1    1    2
[3,]    4    7    5

Stefano

-----Messaggio originale-----
Da: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]Per conto di dreamworx
Inviato: venerdì 26 giugno 2009 15.10
A: r-help at r-project.org
Oggetto: [R] Deleting repeated rows



Appologies if this is a simple problem. I have a matrix which is 86x3 and
each row contains three integers. The problem I have is that some of the
rows of integers are repeated in other rows and I only wish to have one copy
of these rows.

Is there a function that I can use which will identify these repeated rows
and delete them from the matrix? I have searched for help with this problem
but the only function I have found is 'grep' which I'm not sure is of any
use.
-- 
View this message in context: http://www.nabble.com/Deleting-repeated-rows-tp24219989p24219989.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Rispetta l'ambiente: Se non ti è necessario, non stampare questa mail.


"Le informazioni contenute nel presente messaggio di posta elettronica e in ogni suo allegato sono da considerarsi riservate e il destinatario della email è l'unico autorizzato
ad usarle, copiarle e, sotto la propria responsabilità, divulgarle. Chiunque riceva questo messaggio per errore senza esserne il destinatario deve immediatamente rinviarlo
al mittente cancellando l'originale. Eventuali dati personali e sensibili contenuti nel presente messaggio e/o suoi allegati vanno trattati nel rispetto della normativa 
in materia di privacy ( DLGS n.196/'03)".





More information about the R-help mailing list