I want to create an histogram in R like the one below. It should catch a dataframe with the selling number of that specific car on that specific year. So the data is formatted like: multiple columns (different cars) and multiple rows (multiple years). It should select 2 specific years from the rows (2001 and 2019) and show an histogram with the format below. How can I achieve this in R?
My code is:
table <- read_excel("sells.xlsx", sheet = "sheet", range = "A9:AI34")
View(table)
data <- table %>% select(Years, 'mercedes', 'nissan', 'volvo')%>% gather(key = "cars", value = "Total", -Years)