В следующих данных значения y заменены значениями NA. Когда я пытаюсь построить значения в ggplot с помощью следующих кодов, значения, в которые вмешивается NA, не связаны. Как их соединить?
Мои данные:
> dput(dat)
structure(list(iso2c = c("", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", ""), country = c("Chile", "Chile", "Chile", "Chile",
"Chile", "Chile", "Chile", "Chile", "Chile", "Chile", "Chile",
"Chile", "Chile", "Chile", "Chile", "Mexico", "Mexico", "Mexico",
"Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Mexico",
"Mexico", "Mexico", "Mexico", "Mexico", "Mexico", "Uruguay",
"Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay",
"Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay", "Uruguay",
"Uruguay", "Uruguay"), gini = structure(c(NA, 0.504536343101375,
NA, 0.508405328631639, NA, 0.519976764499864, NA, NA, 0.517926578610535,
NA, NA, 0.546104633218656, NA, NA, 0.555941876065133, 0.491403873718798,
NA, 0.493552378351658, NA, 0.475493191921101, NA, 0.505257097450159,
NA, 0.497832261107211, 0.511129547580954, 0.509540976787275,
NA, 0.512466806741829, NA, 0.539429975768021, 0.41795824834724,
0.420833068910888, 0.41522929739879, 0.435913025490141, 0.454821576286135,
0.46476558158648, 0.464685756891657, 0.47909997120289, 0.473975286071775,
0.458674509620144, 0.471347484288568, 0.462187124859573, 0.46655236747263,
0.461672318705308, 0.443881977304363), label = "Gini Coefficient"),
year = c(2014L, 2013L, 2012L, 2011L, 2010L, 2009L, 2008L,
2007L, 2006L, 2005L, 2004L, 2003L, 2002L, 2001L, 2000L, 2014L,
2013L, 2012L, 2011L, 2010L, 2009L, 2008L, 2007L, 2006L, 2005L,
2004L, 2003L, 2002L, 2001L, 2000L, 2014L, 2013L, 2012L, 2011L,
2010L, 2009L, 2008L, 2007L, 2006L, 2005L, 2004L, 2003L, 2002L,
2001L, 2000L)), row.names = c(NA, 45L), class = "data.frame")
Используемые коды:
ggplot(dat, aes(x = year, y = gini, colour = country)) +
geom_line() +
geom_point(aes(shape = country), size=3)+
scale_shape_manual(values=c(1:3))
Я получаю график