0

I am trying to make a plot of year-month vs mean se level but as always, using dates made R quite difficult. My year-month data is in the format of 1859-1, 1859-2, etc. I have 1500 data entries, but the code I've been using limits the entries to 480 so my graph is very uncompleted and the trendline is also not working.

Oulu <- read_excel("C:/Users/MSI-NB/OneDrive/Documentos/Ouludata.xlsx", 
                       col_types = c("numeric", "text", "numeric"))

plot(ym(Oulu$`Year-Month`), Oulu$`Monthly mean sea level (m)`,
 xlab="Year", ylab="Monthly mean sea level (m)",
 xlim = c(1, 1480), ylim=c(0, 8),
 pch=4,)

abline(lm(Oulu$`Year-Month`~Oulu$`Monthly mean sea level (m)`)) 
Mikah T
  • 21
  • 2
  • Hi and welcome. Did you paste half the question? It seems like you’re missing something because the question has the lubridate tag (which is the package you need for this) and the title has ym() (the function that would help you), but the code you posted uses neither. Also, you will get faster help if you provide a minimum reproducible example. See: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – DuckPyjamas Apr 05 '23 at 21:45

0 Answers0