This may sound weird, but I was happy with my script and line graph, and saved it and closed it. This is how it looked:
I decided to go back to edit the label "Year and week" to only "Year", but now I can't get the second blue line to work at all with the exact same script? I'm very confused.
I get this warning message:
1: Removed 3 rows containing missing values (geom_path).
2: Removed 1026 rows containing missing values (geom_path).
Previously it only removed 3 values which were fine, but now it's removing literally all the rows as there are 1026 obs. in this data. It looks like this now with the exact same script:
This is my script:
library(openxlsx) library(ggplot2) library(tidyverse) Vekt <- read.xlsx("../data/Vektny.xlsx") colors <- c("Fresh salmon" = "darkred", "Frozen" = "steelblue") Vekt %>% mutate(Week = as.Date(paste0(Week, 1), "%YW%W%w")) %>% ggplot(aes(x = Week)) + geom_line(aes(y = Fresh, group = 1, color = "Fresh salmon")) + geom_line(aes(y = Frozen, group = 1, color = "Frozen salmon"), linetype = "twodash") + scale_x_date(date_labels = '%Y') + scale_color_manual(values=colors) + ggtitle("Salmon export") + theme(plot.title = element_text(size = 12, hjust = 0.5)) + labs(x = "Year", y = "Ton", color = "Type")
Anyone know what the issue might be? I'm new to this so it might be very obvious