[R] subsetting with by() or other function??

From: Brian S Cade <brian_cade_at_usgs.gov>
Date: Thu 13 Oct 2005 - 07:31:48 EST

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 locid nested within population. I thought I could do something using by(csss3,list(locid, population), function) but don't seem to be having any success. Any suggestions??


Brian S. Cade

U. S. Geological Survey
Fort Collins Science Center
2150 Centre Ave., Bldg. C
Fort Collins, CO 80526-8818

email: brian_cade@usgs.gov
tel: 970 226-9326

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 13 07:36:54 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:42 EST