[R] lapply or data.table to find a unit's previous transaction

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jun 3 05:37:46 CEST 2010

On Wed, Jun 2, 2010 at 10:29 PM, William Rogers <whrogers73 at gmail.com> wrote:
> I have a dataset of property transactions that includes the
> transaction ID (TranID), property ID (UnitID), and transaction date
> (TranDt). I need to create a data frame (or data table) that includes
> the previous transaction date, if one exists.
> This is an easy problem in SQL, where I just run a sub-query, but I'm
> trying to make R my one-stop-shopping program.  The following code

The sqldf package lets you use SQL queries on R data frames.  See its
home page at:

More information about the R-help mailing list