Это мой код:
yearly.ts<- data.frame (Years = as.Date(c('01/01/1985','01/01/1986','01/01/1987','01/01/1988','01/01/1989'),"%d/%m/%Y"),SUMS = c(sum(Appliance.df$Shipments[which(format(Appliance.df$Quarter, "%y")=="85")]),sum(Appliance.df$Shipments[which(format(Appliance.df$Quarter, "%y")=="86")]),sum(Appliance.df$Shipments[which(format(Appliance.df$Quarter, "%y")=="87")]),sum(Appliance.df$Shipments[which(format(Appliance.df$Quarter, "%y")=="88")]),sum(Appliance.df$Shipments[which(format(Appliance.df$Quarter, "%y")=="89")])))
ggplot(yearly.ts) +
geom_line(aes(Years,SUMS,color=SUMS)) +
labs(title = "LINE CHART",caption = "(based on data from yearly.ts)", x = "Years", y = "Shipments") +
ylim(16400,18500) +
scale_x_date(date_labels="%Y",date_breaks ="1 years")
Я получаю следующую ошибку:
Error in format.default(structure(as.character(x), names = names(x), dim = dim(x), : invalid 'trim' argument
Я пытаюсь воспроизвести вывод, который выглядит так:
введите описание изображения здесь