[R] Removing rows with earlier dates

Greg Snow Greg.Snow at imail.org
Sat Dec 25 05:40:07 CET 2010


Whenever a task calls for breaking a data object into pieces, operate on the pieces, then put it back together, then think about using the plyr package. 

Sent from my iPod

On Dec 24, 2010, at 6:58 AM, "Ali Salekfard" <salekfard at googlemail.com> wrote:

> Hi all,
> 
> I'm new to the list but have benfited from it quite extensively. Straight to
> my rather strange question:
> 
> I have a data frame that contains mapping rules in this way:
> 
> ACCOUNT, RULE COLUMNS, Effective Date
> 
> 
> The dataframe comes from a database that stores all dates. What I would like
> to do is to create a data frame with only the most recent rule for each
> account. In traditional programming languages I would loop through each
> account find the most recent rule(s) and fill up my updated data frame.
> 
> Does anyone have any better idea to use R's magic (Its syntax is still
> magical to me) for this problem?
> 
> By the way the list of rules is quite extensive (144643 lines to be
> precise), and there are usually 1-3 most recent rules (rows) for each
> account.
> 
> Thanks.
> 
>    [[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