How to create a bart chart to show the comparison of the average TDG across the
ID: 3789407 • Letter: H
Question
How to create a bart chart to show the comparison of the average TDG across the four types???
I show my steps down here. THANKS
data_movie <- read_excel(path = 'bigmovie.xlsx', sheet = 1, col_names = TRUE)
#Select four types of film
types <- subset(data_movie, Genre == 'Action' | Genre == 'Comedy' | Genre == 'Drama' | Genre == 'Horror')
# Compare the average and standard deviation of Total Domestic Gross (TDG)
avsd <- summarise(group_by(types, Genre),
Total_Domestic_Gross_MEAN = mean(Total_Domestic_Gross), Total_Domestic_Gross_stdev = sd(Total_Domestic_Gross))
table(avsd)
avsd
#Bar_chart
hist <- ggplot(types, aes(x = Genre))
hist <- hist + geom_bar(colour = "black")
hist
Explanation / Answer
Supose to take average TDG of all the four types. Now create a vector of thos average.
for example: avg=[12 12 23 14]
use
barplot(avg) % use this command of R to plot the data.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.