Trying to plot a bar graph, but aes not recognising column name

I am trying to plot a bar graph of the frequency of injuries in a season across multiple seasons.
I have followed regular procedures for creating a ggplot, but the aes function isn't recognising the 'Season' column in the injuries data frame.

injuries <- read.csv(file = "injuries_2010-2020_csv.csv", header = FALSE)
colnames(injuries) <- c("Season", "Date", "Team", "Relinquished", "Notes")

ggplot(injuries, aes(x = Season)) + geom_bar(fill = "#EB9234") +
        labs(x="Season", y = "Total Injuries")

I get an "object 'Season' not found" error, but I am very unsure why this is the case.
I can't seem to figure out

Can you please share a small part of the data set in a copy-paste friendly format?

In case you don't know how to do it, there are many options, which include:

  1. If you have stored the data set in some R object, dput function is very handy.

  2. In case the data set is in a spreadsheet, check out the datapasta package. Take a look at this link.

This happened to me once and it was because my dataset had back ticks in it. So, my first go to with this is to check for back ticks in the data set.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.