I'm working with a time serie of a good number of stations and info on cloud cover. I have no values for year 1996 to 1998. When I plot my time serie, I end up having a graph were there is none of these years on the x axis (no gap in between 1995 to 1999), thus not showing the "hole" in the dataset. I'd like to be able to plot the dataset with this "hole".
This is an example of the dataset (for 1 station) I use (103 different stations from 1978-2020 (except 1996-1997-1998) :
list(year = c("1978", "1979", "1980", "1981", "1982", "1983",
"1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991",
"1992", "1993", "1994", "1995", "1999", "2000", "2001", "2002",
"2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010",
"2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018",
"2019", "2020"), station = c("CYKL", "CYKL", "CYKL", "CYKL",
"CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL",
"CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL",
"CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL",
"CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL", "CYKL",
"CYKL", "CYKL", "CYKL", "CYKL"), yearly_mean = c(6.66913370615075,
6.6097058904658, 6.63321092700948, 6.70511418186491, 6.54047991265942,
6.6260569776694, 6.50415800515247, 6.24652925009775, 6.27738517719698,
6.47124546258661, 6.27052514197829, 6.26910246690519, 6.05107795039979,
6.23566751055814, 6.35965195833086, 6.11188147454036, 6.33670894555142,
6.94058230299598, 6.73775601517714, 6.51150716559123, 6.56145315627824,
6.65851518241965, 6.46056518559336, 7.14419354616137, 7.10972161555151,
7.17952990504808, 6.09962477099579, 5.80124120310416, 6.33046468099031,
6.31358338950744, 5.83258214159217, 6.45865945359556, 6.30835362857386,
5.838640337478, 6.27950436041085, 6.33646147722408, 6.18548111344106,
6.26207275160055, 6.470022441835, 6.28689494938971))
So far this is my code :
py <- all_y_means %>%
ggplot(aes(x=year, y=yearly_mean, group = station)) +
geom_line(aes(color=station)) +
py + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) + theme(legend.position="none")
Can anyone help?
Thanks!


lists (notdata.frames), or did you change the output fromdputfor a reason? (And I was right, youryearis a string, seems counter-intuitive to operate on years as a categorical variable.)factors), at least not permanently (and I'm not talking about usingas.numeric, that's a hack). FYI,dput's output for frames starts withstructure(and should have at least two more named entries after thatlistyou pasted:row.namesandclass="data.frame"(optionally with"tbl_df"or"data.table").