I have a simple dataset that contains three columns of hourly observations over the course of a few days.
The data looks something like...
Time Fast Standard Slow
Aug 02 2020 18:00:00 100 200 300
Aug 02 2020 19:00:00 50 100 150
Aug 02 2020 18:00:00 100 200 300
Aug 03 2020 12:00:00 50 100 150
Aug 03 2020 11:00:00 40 50 70
I start by loading up the CSV:
library(tidyverse)
# Link source
if (!exists("gasprices")) { # Check if the object is not already loaded
if (file.exists("./datafiles/gasprices.rdata")) {
load("./datafiles/gasprices.rdata")
} else {
gasprices <- read.csv("./datafiles/gasprices.csv")
}
But when I go to plot one of the lines, I get a blank plot. I think R is showing every row, when what I really need is three overall change-over-time lines for the three variables (fast, standard, slow). My ideal outcome would show three lines of different colors changing over time in the x axis.
# Plot
g <- ggplot(gasprices, aes(x=Time, y=Fast)) +
geom_line(color = "#00AFBB", size = 2)
xlab("") +
theme_light()
g
Any help would be greatly appreciated. Thank you,