Section 5.9

  1. Pick a measurement you can take on a regular basis. For example, your daily weight or how long it takes you to run 5 miles. Keep a spreadsheet that includes the date, the hour, the measurement, and any other informative variable you think is worth keeping. Do this for 2 weeks. Then make a plot
library(readr)
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(magrittr)
library(lubridate)
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
data2<-read.csv("C:/Users/dimpl/OneDrive/Desktop/Harvard Classes/Data Science R Basics/ch5plotdata.csv")
print(data2)
##          Date Measurement..m.
## 1  01-01-2024            9.37
## 2  01-02-2024            6.89
## 3  01-03-2024           76.70
## 4  01-04-2024           60.80
## 5  01-05-2024           17.90
## 6  01-06-2024            3.15
## 7  01-07-2024           91.32
## 8  01-08-2024           99.33
## 9  01-09-2024           68.20
## 10 01-10-2024           60.40
## 11 01-11-2024           25.60
## 12 01-12-2024           49.40
## 13 01-13-2024           22.90
## 14 01-14-2024           82.10
str(data2)
## 'data.frame':    14 obs. of  2 variables:
##  $ Date           : chr  "01-01-2024" "01-02-2024" "01-03-2024" "01-04-2024" ...
##  $ Measurement..m.: num  9.37 6.89 76.7 60.8 17.9 ...
# Convert to class date
mdy(data2$Date)
##  [1] "2024-01-01" "2024-01-02" "2024-01-03" "2024-01-04" "2024-01-05"
##  [6] "2024-01-06" "2024-01-07" "2024-01-08" "2024-01-09" "2024-01-10"
## [11] "2024-01-11" "2024-01-12" "2024-01-13" "2024-01-14"
str(data2)
## 'data.frame':    14 obs. of  2 variables:
##  $ Date           : chr  "01-01-2024" "01-02-2024" "01-03-2024" "01-04-2024" ...
##  $ Measurement..m.: num  9.37 6.89 76.7 60.8 17.9 ...
data2<-mutate(data2, mdy(data2$Date) )
colnames(data2)<-c('Date', 'Depth', 'NumDate')
class(data2$NumDate)
## [1] "Date"
plot.ts(data2$NumDate, data2$Depth, xlab="Date of Exploration", ylab="Depth (M)", main="Shipwreck of Homosassa River")

?plot.ts
## starting httpd help server ...
##  done