Sorry,

act_2temp <-  act_2[which(!duplicated(act_2[,c(1: 6 )])),] # not 5


Atenciosamente,
Leandro Lins Marino
Centro de Avaliação
Fundação CESGRANRIO
Rua Santa Alexandrina, 1011 - 2º andar
Rio de Janeiro, RJ - CEP: 20261-903
R (21) 2103-9600 R.:236 
( (21) 8777-7907
( lean...@cesgranrio.org.br

"Aquele que suporta o peso da sociedade
    é precisamente aquele que obtém
 as menores vantagens". (SMITH, Adam)

  Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO 
AMBIENTE 


-----Mensagem original-----
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome 
de Leandro Marino
Enviada em: quinta-feira, 12 de março de 2009 08:55
Para: 'Tammy Ma'; r-help@r-project.org
Assunto: [R] RES: Removing rows

Hi Tammy,

You can do:

act_2temp <-  act_2[which(!duplicated(act_2[,c(1:5)])),]
act_2temp[1:5,]
act_2 <- act_2temp
rm(act_2temp)

Atenciosamente,
Leandro Lins Marino
Centro de Avaliação
Fundação CESGRANRIO
Rua Santa Alexandrina, 1011 - 2º andar
Rio de Janeiro, RJ - CEP: 20261-903
R (21) 2103-9600 R.:236 
( (21) 8777-7907
( lean...@cesgranrio.org.br

"Aquele que suporta o peso da sociedade
    é precisamente aquele que obtém
 as menores vantagens". (SMITH, Adam)

  Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO 
AMBIENTE 

-----Mensagem original-----
De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome 
de Tammy Ma
Enviada em: quinta-feira, 12 de março de 2009 06:49
Para: r-help@r-project.org
Assunto: [R] Removing rows



 Hi All,
 
 
> act_2
         Date    Dtime Hour Min Second               Rep
51 2006-02-22 14:52:18   14  52     18  useractivity_act
52 2006-02-22 14:52:18   14  52     18                 4
55 2006-02-22 14:52:49   14  52     49                 4
57 2006-02-22 14:52:51   14  52     51                 4
58 2006-02-22 14:52:52   14  52     52                 3
60 2006-02-22 14:54:42   14  54     42 useractivity_idle
 
I want to change act_2 to 
         Date    Dtime Hour Min Second               Rep
 
51 2006-02-22 14:52:18   14  52     18  useractivity_act
 
52 2006-02-22 14:52:18   14  52     18                 4
58 2006-02-22 14:52:52   14  52     52                 3
60 2006-02-22 14:54:42   14  54     42 useractivity_idle
 
in other word, I want to keep 1st if there are many repeated value, I made the 
program as:
 
 
rm_r<-function(act_2){
 dm<-dim(act_2)[1]-1
 for(i in 2:dm){
   
 if(act_2$Rep[i+1]==act_2$Rep[i]){
   act_2<-act_2[-(i+1),]
   }else{
   act_2<-act_2
   }
 }
return(act_2)
}
 
when it moved one row on 1st loop, i should still start 2 but it become 3 at 
2nd loop, if I add i<-i-1, then i go to 1
seems not reasonbale. How should I modify it`?
 
Tammy
 
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to