Aide-mémoire R
| Besoin | Commandes principales |
|---|---|
| Importer | read_excel(), read_csv() |
| Structure | str(), head(), summary(), dim(), names() |
| Valeurs manquantes | is.na(), colSums(is.na()), na.omit() |
| Effectifs / proportions | table(), prop.table() |
| Moyenne / médiane | mean(), median() |
| Dispersion | sd(), IQR(), quantile() |
| Graphiques | ggplot() + geom_* |
| 2 moyennes indépendantes | t.test(y ~ groupe, data = d) |
| Avant / après | t.test(avant, apres, paired = TRUE) |
| Mann-Whitney | wilcox.test(y ~ groupe, data = d) |
| Association qualitative | chisq.test(tab), fisher.test(tab) |
| Corrélation | cor.test(x, y, method = "pearson") |
| Régression linéaire | lm(y ~ x1 + x2, data = d) |
| Régression logistique | glm(y ~ x1 + x2, family = binomial) |
| Survie | Surv(), survfit(), survdiff(), coxph() |
| Exporter | write.csv(), ggsave() |
| Aide | ?mean, help(t.test), example(lm) |