##Lab 1-CHE451, by DG

###Install package

install.packages("TSA",repos='http://cran.us.r-project.org')
## Installing package into 'C:/Users/Daniela/Documents/R/win-library/4.1'
## (as 'lib' is unspecified)
## package 'TSA' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\Daniela\AppData\Local\Temp\RtmpURKfAE\downloaded_packages

###Oil prices (First exercise)

library(TSA)
## Warning: package 'TSA' was built under R version 4.1.3
## 
## Attaching package: 'TSA'
## The following objects are masked from 'package:stats':
## 
##     acf, arima
## The following object is masked from 'package:utils':
## 
##     tar
data(oil.price)
plot(oil.price,xlab='Time, years',ylab="USD per barrel")

###Oil prices (Second exercise)

data <-read.csv(file="crude-oil-prices.csv",head=TRUE,sep=",")
plot(data$Year,data$Oil.price...Crude.prices.since.1861..current.US..,xlab="Time, years", ylab="USD per barrel",type="l")