I have the time variable and other variables. I want to define my first variable as time and use ggplot to have a nice plot for the two other vaiables with regard to the time.
I didn't try any code because I am stuck on how to figure out what I want. However, here is an (Idea code) which might mimic what I want and before that, there is 15 row of my data:
data <- structure(list(ATime = structure(1:15, .Label = c("00:00", "00:05",
"00:10", "00:15", "00:20", "00:25", "00:30", "00:35", "00:40",
"00:45", "00:50", "00:55", "01:00", "01:05", "01:10", "01:15",
"01:20", "01:25", "01:30", "01:35", "01:40", "01:45", "01:50",
"01:55", "02:00", "02:05", "02:10", "02:15", "02:20", "02:25"), class = "factor"),
ASpeed5 = c(34, 40, 38, 55, 56, 60, 66, 49, 48, 29, 67, 78,
39, 53, 73), BSpeed5 = c(23, 46, 63, 64, 72, 61, 49, 48,
63, 68, 62, 27, 35, 45, 59)), row.names = c(NA, 15L), class = "data.frame")
data$ATime <- as.time(data$ATime)
ggplot(data, aes(x = ATime, y1 = ASpeed5, y2 = BSpeed5))+
geom_line(color = y1, y2)
I am expecting two lines with different colors for each speed (y-axis) with regard to the time(x-axis)