── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)library(stargazer)
Please cite as:
Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
Warning: `as.tibble()` was deprecated in tibble 2.0.0.
ℹ Please use `as_tibble()` instead.
ℹ The signature and semantics have changed, see `?as_tibble`.
# Moyenne et écart type des varaibles numériquesYogurt %>%summarise(across(where(is.numeric) &!all_of("id"), list(mean = mean, sd = sd), na.rm =TRUE))
Warning: There was 1 warning in `summarise()`.
ℹ In argument: `across(...)`.
Caused by warning:
! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
Supply arguments directly to `.fns` through an anonymous function instead.
# Previously
across(a:b, mean, na.rm = TRUE)
# Now
across(a:b, \(x) mean(x, na.rm = TRUE))
# A tibble: 9 × 3
id matiere note
<dbl> <chr> <dbl>
1 1 math 80
2 1 science 75
3 1 english 78
4 2 math 90
5 2 science 95
6 2 english 85
7 3 math 85
8 3 science 88
9 3 english 82
Pivoter le dataframe
Le data frame est dans un format peu commode qui s’appelle un format wide. Il y a beaucoup de colonnes (1 + 4 + 4 + 1 = 10) colonnes. Il est plsu commode et plus parlant statistiquement de créer un format long avec des colonnes id, feat,price, choice. On sera obliger d’ajouter une autre colonne qui identifie la marque en question