rm(list = ls())

library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 2.2.1     ✔ purrr   0.2.4
## ✔ tibble  1.3.4     ✔ dplyr   0.7.4
## ✔ tidyr   0.7.2     ✔ stringr 1.2.0
## ✔ readr   1.1.1     ✔ forcats 0.2.0
## ── Conflicts ─────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(hms)

# set wd()

firstRun = read_csv("Chris+_Beeley+_2017-11-25_09-01-19.csv", 
                    col_types = "????c??????")
secondRun = read_csv("Chris+_Beeley+_2017-12-09_09-03-39.csv",
                     col_types = "????c??????")

# combine datasets

firstRun$Instance = "First"

secondRun$Instance = "Second"

finalData = rbind(firstRun, secondRun)

finalData$Pace = hms(minutes = as.numeric(substr(finalData$Pace, 1, 2)), 
                          seconds = as.numeric(substr(finalData$Pace, 4, 5)))
## Warning in hms(minutes = as.numeric(substr(finalData$Pace, 1, 2)), seconds
## = as.numeric(substr(finalData$Pace, : NAs introduced by coercion
# remove impossible values for Pace

finalData = filter(finalData, Pace < hms(minutes = 11), Pace > hms(minutes = 5), !is.na(Pace))

Pace

ggplot(finalData, aes(x = Time, y = Pace, group = Instance, colour = Instance)) + 
  geom_line()

HR

ggplot(finalData, aes(x = Time, y = HR, group = Instance, colour = Instance)) + 
  geom_line()