[R] Odp: (no subject)

Petr PIKAL petr.pikal at precheza.cz
Thu Jul 29 16:08:00 CEST 2010


Hi 

Your data came rather corrupted but probably you can split your data frame 
according to var1, select highest rank in var2 and reconstruct data frame 
from the result

see
split, lapply, 

Regards
Petr



r-help-bounces at r-project.org napsal dne 29.07.2010 15:48:26:

>   Dear R Users! 
>   I have a dataframe with duplicate cases. Var1 duplicated by var2. 
>                                                var1  
> var2                        var3                        var4  
> var5                        var6                                1  
> 4                        500                        1     2
> a                                1                        3  
> 200                        2                        5     b
> 1                        8                        125     1
> 9                        b                                2  
> 2                        120                        2  
> 52                        b                                2  
> 9                        400                        1  
> 22                        c                                2  
> 6                        22                        1    22
> d                                3                        1  
> 60                        1                        54     s
> 3                        2                        65    1 
> 21                        c                                3  
> 3                        62                        1    36
> a                                4                        3  
> 63                        1                        32     a 
>   I want to delete duplicate ones from var1 which have low rank at var2, 
and 
> keep that case which has highest rank at var2. I would like to keep the 
Whole 
> row (with the other variables: 
>                                                var1  
> var2                        var3                        var4  
> var5                        var6                                1  
> 8                        125                        1     9
> b                                2                        9  
> 400                        1                        22  
> c                                3                        3  
> 62                        1                        36     a
> 4                        3                        63    1 
> 32                        a 
>   Thanks Ag
> 
>    [[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