Analiza podatkov s programom R

« nazaj

Analiza podatkov s programom R - vaje 19.11.2020

Tortni diagram po deležih

#pripravimo podatke
s1224 <- MathAchieve %>% filter(School == 1224)

ggplot(s1224 %>% group_by(Sex) %>% summarise(delez=100 * n() / nrow(s1224))) +
     aes(x="", y=delez, fill=Sex) + geom_col(width=1) +
     coord_polar(theta="y") + xlab("") + ylab("") +
     scale_y_continuous(breaks=seq(0, 100, 10),
                        labels=paste(seq(0, 100, 10), "%"))

Spreminjanje naslova legende

ggplot(MathAchieve %>% filter(MathAch >= quantile(MathAch, 0.95)),
        aes(x=SES, y=MEANSES, color=Sex, shape=Minority, size=MathAch)) +
     geom_point() + guides(size=guide_legend("Dosežek")) +
     scale_size_continuous(breaks=c(23.6, 24.1, 24.7))