¿hay alguna otra forma más directa?
¿cómo haría si tuviera más columnas y quisiera la tasa para cada una?, algo como esto:
datos1datos2 <- read.tablestructure(text = ' list(municipio años poblacion nacimientos defunciones Mun1 2000 50 4 2 Mun2 2000 300 0 2 Mun3 2000 1 3 1 Mun4 2000 100 0 3 Mun5 2000 5 4 1 Mun6 2000 20 3 0 Mun7 2000 20 5 0 Mun8 2000 3 1 3 Mun9 2000 20 2 2 Mun10 2000 20 1 4 Mun1 2001 100 2 3 Mun2 2001 50 2 4 Mun3 2001 10 1 0 Mun4 2001 30 3 3 Mun5 2001 20 3 5 Mun6 2001 60 2 1 Mun7 2001 40 0 5 Mun8 2001 20 5 4 Mun9 2001 20 0 3 Mun10 2001 3 5 0 Mun1 2002 20 4 5 Mun2 2002 5 1 1 Mun3 2002 20 5 4 Mun4 2002 5 3 2 Mun5 2002 20 0 4 Mun6 2002 10 5 2 Mun7 2002 20 5 3 Mun8 2002 20 1 2 Mun9 2002 5 5 2 Mun10 2002 0 0 2 Mun1 2003 20 2 1= c("Mun1", "Mun2", "Mun3", "Mun4", Mun2 2003 25 0 1"Mun5", "Mun6", "Mun7", "Mun8", "Mun9", "Mun10", "Mun1", "Mun2", Mun3 2003 20 1 0"Mun3", "Mun4", "Mun5", "Mun6", "Mun7", "Mun8", "Mun9", "Mun10", Mun4 2003 10 0 3"Mun1", "Mun2", "Mun3", "Mun4", "Mun5", "Mun6", "Mun7", "Mun8", Mun5 2003 20 5 2"Mun9", "Mun10", "Mun1", "Mun2", "Mun3", "Mun4", "Mun5", "Mun6", Mun6 2003 10 0 4"Mun7", "Mun8", "Mun9", "Mun10", "Mun1", "Mun2", "Mun3", "Mun4", Mun7 2003 30 4 3"Mun5", "Mun6", "Mun7", "Mun8", "Mun9", "Mun10"), años = c(2000, Mun8 2003 20 2 12000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2001, 2001, Mun9 2003 60 1 42001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2002, 2002, 2002, Mun10 2003 20 5 22002, 2002, 2002, 2002, 2002, 2002, 2002, 2003, 2003, 2003, 2003, Mun1 2004 20 1 02003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004, Mun2 2004 10 2 12004, 2004, 2004, 2004, 2004), poblacion = c(50, 300, 1, 100, Mun3 2004 20 2 15, 20, 20, 3, 20, 20, 100, 50, 10, 30, 20, 60, 40, 20, 20, 3, Mun4 2004 10 2 420, 5, 20, 5, 20, 10, 20, 20, 5, 0, 20, 25, 20, 10, 20, 10, 30, Mun5 2004 20 3 520, 60, 20, 20, 10, 20, 10, 20, 34, 20, 20, 34, 21), nacimientos = c(4, Mun6 2004 34 3 30, 3, 0, 4, 3, 5, 1, 2, 1, 2, 2, 1, 3, 3, 2, 0, 5, 0, 5, 4, 1, Mun7 2004 20 0 35, 3, 0, 5, 5, 1, 5, 0, 2, 0, 1, 0, 5, 0, 4, 2, 1, 5, 1, 2, 2, Mun8 2004 20 2 52, 3, 3, 0, 2, 4, 1), defunciones = c(2, 2, 1, 3, 1, 0, 0, 3, Mun9 2004 34 4 32, 4, 3, 4, 0, 3, 5, 1, 5, 4, 3, 0, 5, 1, 4, 2, 4, 2, 3, 2, 2, Mun10 2004 21 1 42, 1, 1, 0, 3, 2, 4, 3, 1, 4, 2, 0, 1, 1, 4, 5, 3, 3, 5, 3, 4 ')), headerclass = TRUEc("tbl_df", stringsAsFactors"tbl", "data.frame"), row.names = FALSEc(NA, -50L))