Try this; with(x, data.frame(Case = rep(Case, (Endyear - Startyear) + 1), Year = unlist(mapply(seq, Startyear, Endyear))))
On Tue, Nov 24, 2009 at 4:14 PM, Joseph Magagnoli <jcm...@gmail.com> wrote: > Hi all, > I have a dataframe that has one observation per case. > for example: > > Case Startyear Endyear > A 1979 1989 > B 1950 1955 > > I would like to create a dataframe in which each case has > multiple observations corresponding to the start and end year > for example > > Case Year > A 1979 > A 1980 > A 1981 > . . > . . > . . > A 1989 > B 1950 > B 1951 > and so on > > > > any help would be greatly appreciated. > > Joe > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ R-help@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.