Commit 7d6e0342 authored by Laurent Gatto's avatar Laurent Gatto

Delete student_reports.Rmd

parent 48d1ba86
---
title: "Student reports"
author: "Laurent"
date: "16/03/2020"
output: pdf_document
---
## Data input
Add a first section called Data input, in which you will load the rWSBIM1207 package, use the interroA.csv() function to get the name of a csv file containing test results for a set of students, and read these data into R using read_csv. Display the few first observations and write a short sentence explaining the data.
```{r, message=FALSE, warning=FALSE}
## install.packages("BiocManager")
## install.packages("remotes")
## BiocManager::install("UCLouvain-CBIO/rWSBIM1207")
library(rWSBIM1207)
interroA.csv()
library("tidyverse")
x <- read_csv(interroA.csv())
```
Attention, ne pas faire ceci!!!
```{r}
## read_csv("/usr/local/lib/R/site-library/rWSBIM1207/extdata/interroA.csv")
```
ou
<!-- ceci est un commentaire -->
```{r, message=FALSE}
x <- interroA.csv() %>%
read_csv()
```
Affichage
```{r}
x
```
## Visualisation
Here, the goal is to visualise the score distributions for the four tests using ggplot2. These distributions will be visualised using boxplots. You will need to visualise these distribution for each test separately, and for male and female students.
As discussed during the course, we need data in a long format to be able to use ggplot2. Start by converting these data into a long format using pivot_longer() (or gather()). Display the first rows of these new data and write a short sentence describing them and the transformation you just applied.
```{r}
xl <- x %>%
pivot_longer(names_to = "interro",
values_to = "res",
starts_with("interro"))
```
```{r}
x %>%
gather(key = "interro",
value = "res",
starts_with("interro"))
```
```{r}
x %>%
pivot_longer(names_to = "interro",
values_to = "res",
5:8)
```
```{r}
x %>%
pivot_longer(names_to = "interro",
values_to = "res",
c(interro1, interro2,
interro3, interro4))
```
```{r}
x %>%
pivot_longer(names_to = "interro",
values_to = "res",
-(1:4))
```
Use ggplot2 to visualise the score distributions along boxplots for each test and for female and male students.
```{r}
ggplot(xl, aes(x = interro, y = res)) +
geom_boxplot() +
facet_wrap(~ gender)
```
```{r}
ggplot(xl, aes(x = gender, y = res)) +
geom_boxplot() +
facet_wrap(~ interro)
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment