library(tidyverse)
library(readxl)Q1 <- df1 %>% ggplot(aes(x= Question_1, group = NhomKH)) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count") +
geom_text(aes( label = scales::percent(..prop..),
y= ..prop.. ), stat= "count", vjust = -.0) +
labs(y = "Percent", fill="Question_1") +
facet_grid(~NhomKH) +
scale_y_continuous(labels = scales::percent) + ggtitle("Past behavior") + guides(fill=FALSE)
Q1 + theme(axis.text.x = element_text(angle = 90))Q2 <- df1 %>% ggplot(aes(x= Question_2, group = NhomKH)) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count") +
geom_text(aes( label = scales::percent(..prop..),
y= ..prop.. ), stat= "count", vjust = -.0) +
labs(y = "Percent", fill="Question_2") +
facet_grid(~NhomKH) +
scale_y_continuous(labels = scales::percent) + ggtitle("Intention to open app") + guides(fill = FALSE) + scale_fill_manual(values=c("#000000", "#E69F00", "#56B4E9", "#009E73"))
Q2 + theme(axis.text.x = element_text(angle = 90))Q3 <- df1 %>% ggplot(aes(x= Question_3, group = NhomKH)) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count") +
geom_text(aes( label = scales::percent(..prop..),
y= ..prop.. ), stat= "count", vjust = -.0) +
labs(y = "Percent", fill="Question_3") +
facet_grid(~NhomKH) +
scale_y_continuous(labels = scales::percent) + ggtitle("Decision for subscription") + guides(fill=FALSE) + scale_fill_manual(values=c("#999999", "#E69F00", "#56B4E9", "#009E73", "#CC79A7"))
Q3Q4 <- df1 %>% ggplot(aes(x= Question_4, group = NhomKH)) +
geom_bar(aes(y = ..prop.., fill = factor(..x..)), stat="count") +
geom_text(aes( label = scales::percent(..prop..),
y= ..prop.. ), stat= "count", vjust = -.0) +
labs(y = "Percent", fill="Question_4") +
facet_grid(~NhomKH) +
scale_y_continuous(labels = scales::percent) + ggtitle("Decision for special subcription") + guides(fill=FALSE) + scale_fill_manual(values=c("#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#CC79A7"))
Q4