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

From: Gabor Grothendieck <>
Date: Wed, 02 Jun 2010 23:37:46 -0400

On Wed, Jun 2, 2010 at 10:29 PM, William Rogers <> 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: mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 03 Jun 2010 - 03:40:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jun 2010 - 04:40:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive