-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent-time-plot
More file actions
20 lines (15 loc) · 869 Bytes
/
event-time-plot
File metadata and controls
20 lines (15 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
### trying to plot a graph of run time against event number. initial attempts resulted in y (time) axis being one big blur
### this is most likely because time was not formatted correctly and R thought it was categorical, giving a label for every time point
> library(tidyverse)
###extra bits to fix scan error
> tlpdata <- read.table(file = "C:/Users/computer/desktop/R stuff/tlp50.txt", comment.char = "", fill=T)
###label variables
> event <- tlpdata$V1
> time <- tlpdata$V3 ###V3 not V2 as V3 is correct adjusted time
> gender <- tlpdata$V4
###convert time to class POSIXct, changes format to hh:mm:ss, make event into a continous value
> Time <- as.POSIXct(strptime(time, format="%H:%M:%S"))
> Event = as.numeric(as.character(event))
### graph
> ggplot(data = tlpdata, aes(x = Event, y = Time, color = gender)) +
geom_point() + geom_smooth(colour = "black")