Kindly assist as i am getting the following error,
Error: Aesthetics must be either length 1 or the same as the data (1): x and y
Run rlang::last_error() to see where the error occurred
Below is the code i have been running,
object_1$DOY = as.numeric(yday(object_1$DATE))
object_1$YEAR = as.numeric(format(object_1$DATE, "%Y"))
object_1$MONTH = as.numeric(format(object_1$DATE, "%m"))
object_1$YEAR = as.numeric(format(object_1$DATE, "%Y")) #format of year
index_2002=object_1$YEAR==2002 #indexing and picking the specific year
ggplot(object_1[index_2002,],aes(DATE,LEVEL))+geom_line(aes(DATE,LEVEL,colour="LEVEL"))+
labs(title = "LEVEL TREND", subtitle = "For the year 2002",y="Level", x="Month", caption = "The graph shows a trend of the level of rain for the year 2002
. The highest level of rain was experienced between July and August.")
In particular we need some sample data. A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.