#install packages first if you don't have
library(readxl)
## Warning: package 'readxl' was built under R version 4.0.5
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
library(scales)
## Warning: package 'scales' was built under R version 4.0.5
library(stringr)
## Warning: package 'stringr' was built under R version 4.0.5
competitor <- read.csv("C:/Users/frann/Downloads/CAANH/competitor.csv")
competitor$nonprofit <- str_wrap(competitor$nonprofit, width = 15) #makes nonprofit names on x-axis stacked
hist <- ggplot(data=competitor, aes(x=nonprofit, y=stars, fill=stars)) +
geom_bar( #determine the number of bins
color = "white",
stat="identity") +
theme_classic() +
geom_text(aes(label=stars), vjust=1.6, color="white", size=3.5)+
ggtitle("Facebook Reviews") +
xlab("") + ylab("Stars") +
theme(plot.title = element_text(size = 16, #title formatting
face = "bold"))+theme(legend.position="none")
hist

competitor$nonprofit <- str_wrap(competitor$nonprofit, width = 15) #makes nonprofit names on x-axis stacked
hist <- ggplot(data=competitor, aes(x=nonprofit, y=reviews, fill=reviews)) +
geom_bar( #determine the number of bins
color = "white",
stat="identity") +
theme_classic() +
geom_text(aes(label=reviews), vjust=1.6, color="white", size=3.5)+
ggtitle("Number of Facebook Reviews") +
xlab("") + ylab("Number of Reviews") +
theme(plot.title = element_text(size = 16, #title formatting
face = "bold"))+theme(legend.position="none")
hist

competitor$nonprofit <- str_wrap(competitor$nonprofit, width = 15) #makes nonprofit names on x-axis stacked
hist <- ggplot(data=competitor, aes(x=nonprofit, y=stars, fill=reviews)) +
geom_bar( #determine the number of bins
color = "white",
stat="identity") +
theme_classic() +
geom_text(aes(label=reviews), vjust=1.6, color="white", size=3.5)+
ggtitle("Facebook Star Ratings with Number of Reviews Fill") +
xlab("") + ylab("Stars") +
theme(plot.title = element_text(size = 16, #title formatting
face = "bold"))+theme(legend.position="none")
hist

competitor$nonprofit <- str_wrap(competitor$nonprofit, width = 15) #makes nonprofit names on x-axis stacked
hist <- ggplot(data=competitor, aes(x=nonprofit, y=reviews, fill=stars)) +
geom_bar( #determine the number of bins
color = "white",
stat="identity") +
theme_classic() +
geom_text(aes(label=stars), vjust=1.6, color="white", size=3.5)+
ggtitle("Facebook Reviews with Star Fill") +
xlab("") + ylab("Number of Reviews") +
theme(plot.title = element_text(size = 16, #title formatting
face = "bold"))+theme(legend.position="none")
hist

comp <- read_excel("C:/Users/frann/Downloads/CAANH/Competitors.xlsx")
comp$Nonprofit <- str_wrap(comp$Nonprofit, width = 15) #makes nonprofit names on x-axis stacked
hist <- ggplot(data=comp, aes(x=Nonprofit, y=`Account Likes on Facebook`, fill=`Account Likes on Facebook`)) +
geom_bar( #determine the number of bins
color = "white",
stat="identity") +
theme_classic() +
geom_text(aes(label=`Account Likes on Facebook`), vjust=1.6, color="white", size=3.5)+
ggtitle("Account Likes on Facebook") +
xlab("") + ylab("# of likes") +
theme(plot.title = element_text(size = 16, #title formatting
face = "bold"))+ theme(legend.position="none")
hist
