#Installing and/or updating Packages
library(readxl)
library(tidyverse)
library(scales)
library(lubridate)
library(ggrepel)
library(tinytex)
library(xtable)
fp <- read_excel("Downloads/fp.xlsx")
getwd()
dim(fp)
summary(fp)
fp %>% count(Organization)
fp %>% count(Rol)
fp %>% count(Perception)
fp %>% count(Comunicación)
# Percents in barplot
ggplot(data = fp, mapping = aes(x =Organization)) + geom_bar(fill="darkgrey", color="black")+labs(y="Frecuencia", x="Organización deportiva")+theme_classic()

ggplot(data = fp, mapping = aes(x =Rol)) + geom_bar(fill="darkgrey", color="black")+labs(y="Frecuencia", x="Rol en la organización deportiva")+theme_classic()

ggplot(data = fp, mapping = aes(x =Perception)) + geom_bar(fill="darkgrey", color="black")+labs(y="Frecuencia", x="La formación permanente cualifica su comunidad deportiva")+theme_classic()

ggplot(data = fp, mapping = aes(x =Organization, y = stat(prop), group = 1)) + geom_bar(fill="darkgrey", color="black")+labs(y="Porcentajes", x="Organización deportiva")+theme_classic() + geom_text(aes(label = percent(..count../sum(..count..))), stat = "count", position = position_stack(0.7), color = "Black")

ggplot(data = fp, mapping = aes(x =Rol, y = stat(prop), group = 1)) + geom_bar(fill="darkgrey", color="black")+labs(y="Porcentajes", x="Rol en la organización deportiva")+theme_classic() + geom_text(aes(label = percent(..count../sum(..count..))), stat = "count", position = position_stack(0.7), color = "Black")

ggplot(data = fp, mapping = aes(x =Perception, y = stat(prop), group = 1)) + geom_bar(fill="darkgrey", color="black")+labs(y="Porcentajes", x="La formación permanente cualifica su comunidad deportiva")+theme_classic() + geom_text(aes(label = percent(..count../sum(..count..))), stat = "count", position = position_stack(0.7), color = "Black")

# Percents in stacked barplot
ggplot(data = fp, aes(x = PsicologÃa, fill = Rol)) +
geom_bar(position = "fill") +
scale_fill_manual(values = c("Red", "Blue", "Green", "Yellow", "Pink"))

ggplot(data = fp, aes(x = PsicologÃa, fill = Rol)) +
geom_bar(position = "fill") +
scale_fill_manual(values = c("Red", "Blue", "Green", "Yellow", "Pink"))
