In my data, times were recorded in hours:minutes like 0:00, 0:15.
It looked like this:
time avg_holds month
<fct> <dbl> <chr>
1 0:00 1.15 June
2 0:15 0.396 June
3 0:30 0 June
4 0:45 4.76 June
5 1:00 1.59 June
6 1:15 0 June
7 1:30 0 June
8 1:45 0 June
9 10:00 2.19 June
10 10:15 3.65 June
I am trying to get a plot with times on the x axis, avg_holds on the y axis. The times are confusing me.
dataset <- read.table(text = 'time avg_holds month
0:00 1.15 June
0:15 0.396 June
0:30 0 June
0:45 4.76 June
1:00 1.59 June
1:15 0 June
1:30 0 June
1:45 0 June
10:00 2.19 June
10:15 3.65 June',
header = TRUE,
stringsAsFactors = FALSE)
with(data = dataset,
expr =
{
time = as.POSIXct(x = time,
format = "%H:%M") # assuming 24 hour time format
plot(x = time,
y = avg_holds)
})