Hey everyone, I am looking for the easiest way to get this table
# Table2 Year / 2000 / 2002 / 2004 Julia / 3 / 4 / 1 Peter / 1 / 2 / 4 ... / ... / ... / ... out of this one? # Table1 name / year / cases Julia / 2000 / 1 Julia / 2000 / 2 Julia / 2002 / 4 Peter / 2000 / 1 Julia / 2004 / 1 Peter / 2004 / 2 Peter / 2002 / 2 Peter / 2004 / 2 ... / ... / ... Code for table1: name <- c('Julia','Julia','Julia','Peter','Julia','Peter','Peter','Peter') year <- c(2000,2000,2002,2000,2004,2004,2002,2004) cases <- c(1,2,4,1,1,2,2,2) table1 <- data.frame(name,year,cases) Thanks! Dominik ______________________________________________ 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.