diff --git a/01_Intro/EDA.R b/01_Intro/EDA.R index 47335b4..47c9cf2 100644 --- a/01_Intro/EDA.R +++ b/01_Intro/EDA.R @@ -14,25 +14,32 @@ library(lubridate) ## Diamonds ---- +# Charger les données data(diamonds) +# Affichage des premières lignes diamonds +# Structure des données diamonds %>% str +# Résumé stat des données diamonds %>% summary +# Écart type pour les variables numériques diamonds %>% keep(is.numeric) %>% map(sd) +# Distribution des valeurs de carats (continu) diamonds %>% ggplot() + aes(x = carat) + geom_histogram(binwidth = .05) +# Distribution des valeurs de coupe (catégoriel) diamonds %>% ggplot() + aes(x = cut) + @@ -40,6 +47,7 @@ diamonds %>% # … +# Fonction pour afficher une distribution plot_desc <- function(x, var, ...) { x %>% @@ -52,9 +60,11 @@ plot_desc <- function(x, var, ...) g + geom_bar(...) } +# Application diamonds %>% plot_desc("carat", binwidth = .01) +# Application en masse diamonds %>% keep(is.numeric) %>% names %>% @@ -67,30 +77,24 @@ diamonds %>% map(~plot_desc(diamonds, .)) %>% set_names(diamonds %>% keep(is.factor) %>% names) -> plots +# Matrice de relations entre les variables diamonds %>% sample_n(1000) %>% plot +# Association entre deux variables (continue/catégorielle) diamonds %>% ggplot() + aes(x = carat, fill = clarity) + geom_histogram(position = "fill") -diamonds %>% - ggplot() + - aes(x = carat, fill = cut) + - geom_histogram(position = "fill") - -diamonds %>% - ggplot() + - aes(x = carat, fill = color) + - geom_histogram(position = "fill") - +# Association entre deux variables continues diamonds %>% ggplot() + aes(x = x, y = y) + geom_point() +# Association entre 3 variables diamonds %>% ggplot() + aes(x = carat, y = price, color = color) + @@ -104,4 +108,4 @@ data(gapminder) read_csv2("commits.csv") -# Commits par jour ? En fonction de l'heure ? Par jour et par heure ? boulot/perso ? en semaine/week-end ? \ No newline at end of file +# Commits par jour ? En fonction de l'heure ? Par jour et par heure ? boulot/perso ? en semaine/week-end ? diff --git a/01_Intro/intro.odp b/01_Intro/intro.odp index c04ebdb..38a1928 100644 Binary files a/01_Intro/intro.odp and b/01_Intro/intro.odp differ