#abro df
df <- read.csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vTF86ZlgETQ0kDjF2e2Gye8qNp2w4qQSIhZj3lFMWc6dS-mMDYr3qaXSkQ8lcklRT3VBe3ec8YOk-N5/pub?gid=1492451979&single=true&output=csv")
#packges
library("tidyverse")
#agrupo
df %>%
group_by(Sexo, Forma) %>%
summarise(n=n())
`summarise()` has grouped output by 'Sexo'. You can override using the `.groups` argument.
#grafica
df %>%
Warning messages:
1: In readChar(file, size, TRUE) : truncating string with embedded nuls
2: In readChar(file, size, TRUE) : truncating string with embedded nuls
group_by(Sexo, Forma) %>%
summarise(n=n()) %>%
ggplot(aes(Forma, n)) +
geom_bar(aes(fill = Sexo), position = "dodge", stat="identity")+
theme_classic()+
ylab("Frecuencia")+
theme(axis.title.x = element_text(size=rel(2))) +
theme(axis.title.y = element_text( size=rel(2))) +
theme (axis.text.x = element_text(face="bold", colour="black", size=rel(2)),
axis.text.y = element_text(face="bold", colour="black", size=rel(2))) +
geom_signif(y_position = c(35), xmin = c(1.8),
xmax = c(2.2), annotation = c("*"))
`summarise()` has grouped output by 'Sexo'. You can override using the `.groups` argument.
#Tabla sexo por forma
table(df$Sexo, df$Forma)
Cilindrica Embudo Huso Reloj
Femenino 38 32 7 19
Masculino 19 3 2 12
#diferencias entre sexo y morfologia (tipo)
chisq.test(df$Forma, df$Sexo)
Chi-squared approximation may be incorrect
Pearson's Chi-squared test
data: df$Forma and df$Sexo
X-squared = 9.3871, df = 3, p-value = 0.02456
#la tabla a objeto para hacer grafica de mosaico
a <- table(df$Sexo, df$Forma)
#grafica mosaico