Thanks a lot! Both solutions work great! On Thu, Oct 7, 2010 at 7:19 PM, Gabor Grothendieck <ggrothendi...@gmail.com> wrote: > On Thu, Oct 7, 2010 at 1:05 PM, stefan.d...@gmail.com > <stefan.d...@gmail.com> wrote: >> Hello, >> I have data in the following form >> >> age sex Int.Prev.Est.1 Int.Prev.Est.2 Int.Prev.Est.3 >> Int.Prev.Est.4 Int.Prev.Est.5 >> 93110 93 0 23.75482 57.86592 9.755003 >> 4.343534 4.280714 >> 93610 93 1 53.36475 39.47247 4.381618 >> >> and want to get it in the form: >> >> age sex cat Int.Prev.Est >> 93 0 1 23.75482 >> 93 0 2 57.86592 >> 93 0 3 9.755003 >> 93 0 4 4.343534 >> (....) > > Try this: > > reshape(UK.INT, dir = "long", idvar = 1:2, varying = list(3:7), > v.names = "Int.Prev.Est", timevar = "cat") > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com >
______________________________________________ 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.