# Libraries
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(TSstudio)
## Warning: package 'TSstudio' was built under R version 4.1.2
library(ggplot2)
library(scales)
library(scales)
setwd("C:/Users/gru_e/OneDrive/Desktop/DATA110/FinalProject")
data <- read.csv("National_trips.csv")
#Change column names to lowercase letters from capital
names(data)<-tolower(names(data))
data$date <- as.Date(data$date)
#head(data)
data$date <- as.Date(data$date)
data$number.of.trips <- gsub(",","", data$number.of.trips)
data$number.of.trips <- as.double(data$number.of.trips)
#str(data)
econ_mod <- data %>%
filter(date >= as.Date("2019-01-01") & date < as.Date("2019-12-31"))
# Create the base plot, which does not specify the breaks
econ_plot <- ggplot(econ_mod, aes(x = date,y=number.of.trips)) +
geom_line()
econ_plot

#data %>%
# mutate(trip_in_million = number.of.trips/1000000)
#install.package("gcookbook") # Load gcookbook for the tg data set
library(gcookbook)
tg
## supp dose length
## 1 OJ 0.5 13.23
## 2 OJ 1.0 22.70
## 3 OJ 2.0 26.06
## 4 VC 0.5 7.98
## 5 VC 1.0 16.77
## 6 VC 2.0 26.14
# Map supp to colour
ggplot(tg, aes(x = dose, y = length, colour = supp)) +
geom_line()

# Map supp to linetype
ggplot(tg, aes(x = dose, y = length, linetype = supp)) +
geom_line()
