ggplot line plot of this "egarch.forecast$`1973-04-01 01:00:00`" in r

To create a line plot using ggplot2 of a time series like egarch.forecast$'1973-04-01 01:00:00' in R, follow these steps:

  1. Convert the time series data into a data frame with two columns: one for the time (date) and another for the values.
main.r
library(dplyr) # for pipe operator and data manipulation functions
library(ggplot2) # for creating plots
egarch.data <- as.data.frame(egarch.forecast$`1973-04-01 01:00:00`) %>% 
  mutate(date = as.Date(row.names(.)), value = as.numeric(egarch.forecast$`1973-04-01 01:00:00`))
276 chars
5 lines
  1. Create a line plot using ggplot2. In this example, we use the geom_line function to create the line plot, mapping the date variable to the x-axis and the value variable to the y-axis. You may want to modify the x and y axis labels and add a title to the plot.
main.r
ggplot(egarch.data, aes(x = date, y = value)) + 
  geom_line() + 
  xlab("Date") + 
  ylab("Value") + 
  ggtitle("EGARCH Forecast for April 1973")
147 chars
6 lines

This should create a line plot of your time series data using ggplot2.

gistlibby LogSnag