I have a problem wrapping my head around how to use the autoplot function with Dates correctly. I downloaded a csv. file from here: nasdaq >https://www.nasdaq.com/market-activity/futures/us/historicall (30 year treasury bills historical data)
and tried to visualize its closing price over time. Any tips or pointers are appreciated. The ggplot visualization also looks not correct. Can I somehow make better graphs/plots?
library(dplyr)
library(lubridate)
library(ggplot2)
library(feasts)
library(fabletools)
library(tidyverse)
library(forecast)
csv_data_3 <- read.csv("HistoricalData_5_years_US_treasury.csv")
csv_data_4 <- read.csv("nasdaq_COMP.csv")
z_treasuries5Years <- mutate(csv_data_3, Volume=NULL, Open = NULL, High = NULL, Low=NULL) %>%
mutate(dateFormatted = as.Date(Date,"%m/%d/%y"))
TsibTreasuries <- as_tsibble(z_treasuries5Years, key = Close.Last,index= dateFormatted)
autoplot(TsibTreasuries, Close.Last)
ggplot() +
geom_line(TsibTreasuries, mapping = aes(x = dateFormatted,y = Close.Last)) +
theme_minimal()+
scale_x_continuous("Date") +
scale_y_continuous("Closing Price")
#class(z_treasuries5Years$Date) for checking if date is data