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::lag()    masks stats::lag()
library(hms)

# set wd()

col_types = "????c??????")
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()