#Creating data frame
df <- data.frame(
time = factor(c("Lunch","Dinner"), levels=c('Lunch','Dinner')),
totalbill = c(45.3, 54.8)
)
library(ggplot2)
## Warning in as.POSIXlt.POSIXct(Sys.time()): unable to identify current timezone 'S':
## please set environment variable 'TZ'
df
#Plotting the barplot
ggplot(data = df, aes(x = time, y = totalbill, fill=time)) + geom_bar(stat = "identity")