gganimate with multiple lines

structure(list(Year = c(2000L, 2001L, 2002L, 2003L, 2004L, 2005L,
2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L,
2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L,
2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2000L,
2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L,
2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2000L, 2001L, 2002L,
2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L,
2012L, 2013L, 2014L, 2015L, 2000L, 2001L, 2002L, 2003L, 2004L,
2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L,
2014L, 2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L,
2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L,
2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L,
2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2000L, 2001L,
2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L,
2011L, 2012L, 2013L, 2014L, 2015L, 2000L, 2001L, 2002L, 2003L,
2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L,
2013L, 2014L, 2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L,
2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L,
2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L,
2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2000L,
2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L,
2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2000L, 2001L, 2002L,
2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L,
2012L, 2013L, 2014L, 2015L, 2000L, 2001L, 2002L, 2003L, 2004L,
2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L,
2014L, 2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L,
2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L,
2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L,
2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L, 2000L, 2001L,
2002L, 2003L, 2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L,
2011L, 2012L, 2013L, 2014L, 2015L, 2000L, 2001L, 2002L, 2003L,
2004L, 2005L, 2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L,
2013L, 2014L, 2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L,
2006L, 2007L, 2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L,
2015L, 2000L, 2001L, 2002L, 2003L, 2004L, 2005L, 2006L, 2007L,
2008L, 2009L, 2010L, 2011L, 2012L, 2013L, 2014L, 2015L), Sector = c("Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry"), Country = c("Afghanistan",
"Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
"Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
"Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh",
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh",
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh",
"Bangladesh", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan",
"Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan",
"Bhutan", "Bhutan", "Bhutan", "Bhutan", "China", "China", "China",
"China", "China", "China", "China", "China", "China", "China",
"China", "China", "China", "China", "China", "China", "India",
"India", "India", "India", "India", "India", "India", "India",
"India", "India", "India", "India", "India", "India", "India",
"India", "Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Maldives", "Maldives", "Maldives", "Maldives",
"Maldives", "Maldives", "Maldives", "Maldives", "Maldives", "Maldives",
"Maldives", "Maldives", "Maldives", "Maldives", "Maldives", "Maldives",
"Nepal", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal",
"Nepal", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal",
"Nepal", "Nepal", "Pakistan", "Pakistan", "Pakistan", "Pakistan",
"Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan",
"Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan",
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka",
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka",
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka",
"Sri Lanka", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
"Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
"Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
"Afghanistan", "Afghanistan", "Bangladesh", "Bangladesh", "Bangladesh",
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh",
"Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh", "Bangladesh",
"Bangladesh", "Bangladesh", "Bangladesh", "Bhutan", "Bhutan",
"Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan",
"Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan", "Bhutan",
"China", "China", "China", "China", "China", "China", "China",
"China", "China", "China", "China", "China", "China", "China",
"China", "China", "India", "India", "India", "India", "India",
"India", "India", "India", "India", "India", "India", "India",
"India", "India", "India", "India", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Lower middle income",
"Lower middle income", "Lower middle income", "Maldives", "Maldives",
"Maldives", "Maldives", "Maldives", "Maldives", "Maldives", "Maldives",
"Maldives", "Maldives", "Maldives", "Maldives", "Maldives", "Maldives",
"Maldives", "Maldives", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal",
"Nepal", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal", "Nepal",
"Nepal", "Nepal", "Nepal", "Nepal", "Pakistan", "Pakistan", "Pakistan",
"Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan",
"Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan", "Pakistan",
"Pakistan", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka",
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka",
"Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka", "Sri Lanka",
"Sri Lanka", "Sri Lanka"), Value = c(0, 0, 38.63, 37.42, 29.72,
31.11, 28.64, 30.11, 24.89, 29.3, 26.21, 23.74, 24.39, 22.81,
22.14, 20.63, 22.72, 21.85, 20.58, 19.81, 19.27, 18.57, 18.03,
17.81, 17.6, 17.1, 17, 16.81, 16.18, 15.49, 15.35, 14.78, 26.8,
25.57, 25.52, 24.39, 23.98, 22.34, 21.41, 18.67, 18.41, 18.23,
16.8, 16.33, 15.96, 16.1, 16.62, 16.71, 14.68, 13.98, 13.3, 12.35,
12.92, 11.64, 10.63, 10.25, 10.17, 9.64, 9.33, 9.18, 9.11, 8.94,
8.67, 8.42, 21.61, 21.62, 19.54, 19.58, 17.81, 17.62, 16.81,
16.75, 16.79, 16.74, 17.03, 17.19, 16.85, 17.15, 16.79, 16.17,
20.06, 20.14, 19.83, 19.29, 17.83, 17.1, 16.44, 16.35, 16.57,
16.77, 16.42, 16.46, 16.03, 16.01, 15.92, 15.8, 8.76, 6.42, 6.22,
5.31, 5.58, 7.73, 6.6, 6.17, 6.88, 5.42, 5.63, 5.39, 5.19, 5.41,
5.31, 5.56, 38.24, 35.25, 36.15, 35.11, 34.68, 33.82, 32.37,
31.16, 30.31, 31.32, 33.18, 34.98, 33.15, 31.53, 30.27, 29.38,
24.14, 22.45, 21.75, 21.73, 20.65, 20.22, 21.61, 21.8, 22.5,
22.72, 23.28, 25.13, 23.71, 23.83, 23.74, 23.82, 19.93, 20.07,
14.28, 13.23, 12.54, 11.82, 11.34, 11.68, 13.38, 12.69, 8.5,
8.83, 7.45, 7.67, 8.01, 8.18, 0, 0, 23.81, 22.71, 26.23, 26.81,
28.21, 26.88, 26.92, 21.9, 21.15, 22.74, 21.16, 20.44, 21.23,
22.12, 22.28, 22.58, 22.84, 22.47, 22.78, 23.3, 24.1, 24.5, 24.73,
25.3, 24.96, 25.05, 25.31, 26.31, 26.31, 26.83, 35.22, 37.1,
37.4, 38.11, 36.31, 35.93, 37.7, 44.05, 43.2, 41.97, 42.78, 40.98,
41.62, 42.35, 41.1, 41.33, 45.54, 44.79, 44.45, 45.62, 45.9,
47.02, 47.56, 46.89, 46.97, 45.96, 46.5, 46.53, 45.42, 44.18,
43.28, 41.11, 27.28, 26.44, 27.61, 27.44, 29.22, 29.53, 30.93,
30.9, 31.14, 31.12, 30.73, 30.16, 29.4, 28.4, 27.66, 27.35, 30.82,
30.91, 30.97, 30.55, 31.9, 32.37, 32.79, 32.78, 33.22, 32.06,
31.66, 31.98, 31.5, 30.78, 30.13, 29.01, 15.04, 12.3, 12.62,
12.38, 11.06, 11.73, 9.52, 8.75, 11.45, 9.62, 9.43, 10.07, 9.79,
8.06, 8.41, 10.68, 20.74, 16.66, 16.95, 16.97, 16.66, 16.47,
16.07, 15.87, 16.05, 15.07, 14.2, 14.11, 14.1, 14.15, 13.83,
13.72, 21.72, 22.38, 22.22, 22.23, 25.12, 25.53, 19.67, 19.98,
21.74, 19.19, 19.72, 20.5, 21.3, 20.22, 20.03, 19.09, 27.32,
26.82, 28.01, 28.42, 28.62, 30.19, 30.64, 29.92, 29.37, 29.67,
26.64, 28, 30.13, 29.16, 28.3, 27.17), PerCapitaGDP = c(0, 0,
330.3, 343.08, 333.22, 357.23, 365.28, 405.55, 412.01, 488.3,
543.3, 528.74, 576.19, 587.57, 583.66, 574.18, 524.95, 541.29,
551.9, 568.14, 588.33, 617.54, 649.93, 687.32, 720.36, 748.3,
781.15, 822.19, 865.75, 907.26, 951.31, 1002.39, 1165.33, 1234.57,
1339.54, 1415.06, 1472.75, 1553.51, 1638.02, 1909.96, 1980.96,
2091.94, 2312.86, 2467.31, 2561.83, 2584.83, 2699.82, 2844.32,
1767.83, 1901.41, 2061.16, 2253.93, 2467.13, 2732.17, 3062.53,
3480.15, 3796.63, 4132.9, 4550.45, 4961.23, 5325.16, 5710.59,
6096.49, 6484.44, 826.59, 851.62, 869.2, 922.17, 979.28, 1040.31,
1106.93, 1173.88, 1192.51, 1268.25, 1357.56, 1410.43, 1469.18,
1544.62, 1640.18, 1751.66, 1100.92, 1130.17, 1162.77, 1212.99,
1276.35, 1338.35, 1408.31, 1483.36, 1527.37, 1577.89, 1659.71,
1715.8, 1777.41, 1849.65, 1925.6, 2003.73, 5797.6, 5434.6, 5673.46,
6272.39, 6467.48, 5471.7, 6734.43, 7087.65, 7572.8, 6827.65,
7076.66, 7384.85, 7251.68, 7436.06, 7624.77, 7501.55, 455.28,
469.17, 462.55, 473.98, 489.57, 500.21, 510.65, 521.74, 547.7,
567.91, 592.4, 612.03, 642.52, 670.84, 711.3, 732, 825.86, 821.26,
827.49, 847.51, 889.22, 935.66, 970.94, 994.9, 989.19, 994.74,
988.75, 994.23, 1007.44, 1029.84, 1055.66, 1082.77, 1825.14,
1784.19, 1840.26, 1933.19, 2021.31, 2130.13, 2275.89, 2412.69,
2538.09, 2609.69, 2799.65, 3014.58, 3286.01, 3371.18, 3505.55,
3647.39, 0, 0, 330.3, 343.08, 333.22, 357.23, 365.28, 405.55,
412.01, 488.3, 543.3, 528.74, 576.19, 587.57, 583.66, 574.18,
524.95, 541.29, 551.9, 568.14, 588.33, 617.54, 649.93, 687.32,
720.36, 748.3, 781.15, 822.19, 865.75, 907.26, 951.31, 1002.39,
1165.33, 1234.57, 1339.54, 1415.06, 1472.75, 1553.51, 1638.02,
1909.96, 1980.96, 2091.94, 2312.86, 2467.31, 2561.83, 2584.83,
2699.82, 2844.32, 1767.83, 1901.41, 2061.16, 2253.93, 2467.13,
2732.17, 3062.53, 3480.15, 3796.63, 4132.9, 4550.45, 4961.23,
5325.16, 5710.59, 6096.49, 6484.44, 826.59, 851.62, 869.2, 922.17,
979.28, 1040.31, 1106.93, 1173.88, 1192.51, 1268.25, 1357.56,
1410.43, 1469.18, 1544.62, 1640.18, 1751.66, 1100.92, 1130.17,
1162.77, 1212.99, 1276.35, 1338.35, 1408.31, 1483.36, 1527.37,
1577.89, 1659.71, 1715.8, 1777.41, 1849.65, 1925.6, 2003.73,
5797.6, 5434.6, 5673.46, 6272.39, 6467.48, 5471.7, 6734.43, 7087.65,
7572.8, 6827.65, 7076.66, 7384.85, 7251.68, 7436.06, 7624.77,
7501.55, 455.28, 469.17, 462.55, 473.98, 489.57, 500.21, 510.65,
521.74, 547.7, 567.91, 592.4, 612.03, 642.52, 670.84, 711.3,
732, 825.86, 821.26, 827.49, 847.51, 889.22, 935.66, 970.94,
994.9, 989.19, 994.74, 988.75, 994.23, 1007.44, 1029.84, 1055.66,
1082.77, 1825.14, 1784.19, 1840.26, 1933.19, 2021.31, 2130.13,
2275.89, 2412.69, 2538.09, 2609.69, 2799.65, 3014.58, 3286.01,
3371.18, 3505.55, 3647.39)), row.names = c(NA, -320L), groups = structure(list(
Sector = c("Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Agriculture", "Agriculture",
"Agriculture", "Agriculture", "Industry", "Industry", "Industry",
"Industry", "Industry", "Industry", "Industry", "Industry",
"Industry", "Industry"), Country = c("Afghanistan", "Bangladesh",
"Bhutan", "China", "India", "Lower middle income", "Maldives",
"Nepal", "Pakistan", "Sri Lanka", "Afghanistan", "Bangladesh",
"Bhutan", "China", "India", "Lower middle income", "Maldives",
"Nepal", "Pakistan", "Sri Lanka"), .rows = list(1:16, 17:32,
33:48, 49:64, 65:80, 81:96, 97:112, 113:128, 129:144,
145:160, 161:176, 177:192, 193:208, 209:224, 225:240,
241:256, 257:272, 273:288, 289:304, 305:320)), row.names = c(NA,
-20L), class = c("tbl_df", "tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))

I am using above data to animate lines but I am unsuccessful with the code below.

ggplot(ggr3, aes(Year, Value, colour = Sector)) +
geom_line() + facet_wrap(~Country) +
labs(title = 'Sectoral Share in Economy: {frame_time}',
x = 'Year', y = '% of GDP') +
transition_time(Year) +
ease_aes('linear')

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.