search for: lag1dbc

Displaying 2 results from an estimated 2 matches for "lag1dbc".

2005 Oct 13
1
subsetting data frame using by() or tapply() or other
Ok so I see the problem that I'm having creating a new variable (LAG1DBC) in the example data transformation below is that tapply() is creating a list that is not dimensionally consistent with the data frame (data). So how do I go from the list output of tapply() to create a dimensionally consistent vector that can create the new variable in my original data frame...
2005 Oct 12
2
subsetting with by() or other function??
I think I must be missing something obvious, but I'm having trouble getting a data transformation to work on groupings of data within a data frame (csss3) as defined by 2 factors (population, locid). The data are sorted by year within locid within population and I want to lag another variable (dbc), i.e, shift them down by 1 row replacing the first row with NA, within groups defined by