The goal of learningr is to provide interactive tutorials for the statistics classes given by Tristan for UE 2.4. The tutorial are shamelessly taken from rstudio-education for the basics of R and the tidyverse. Tutorials are packaged so you can install them on you computer and do the exercices without access to an internet connection.
You only need to perform each of the following steps once:
- installing R
- installing Rstudio
- installing R packages
remotes
andlearnr
However each of them may take some time.
Go to the CRAN webpage, select your OS and follow the instructions.
- On Windows, you should just download and execute an .exe file.
- On MacOS, you should just download and execute a .pkg file.
- On Linux, you can get install R from the command line using something like
## If you're on Ubuntu
sudo apt-get install r-base
Go to the download page. Select, download and install the file corresponding to your OS.
Launch Rstudio (by clicking on the corresponding icon) and execute the following commands in the console
install.packages("remotes")
install.packages("learnr")
On Windows: you may need Rtools and git
- Rtools: visit the dedicated page, download the suggested exe and install it on your computer
- git: visit the dedicated page, download the suggested exe and install it on your computer
On MacOS: you may need XCode
- XCode: visit the dedicated page, download the Mandatory tools and install them on your computer
You need to install the tutorials every time there is an update (hopefully not too often)
You can install the tutorials from GitHub by launching Rstudio and typing the following command in the console:
remotes::install_github("mahendra-mariadassou/learningr")
Alternatively, you can use a remote R session to complete the tutorial by launching binder:
You only need a web browser, no account or anything and the tutorials will always be up to date. The main drawbacks of this solution (compared to the previous one) are that (i) you lose your progress each time you launch a new session and (ii) the binder image may take some time to launch (usually a few minutes).
Whenever I fix a bug / typo or add new content, you need to update the tutorials on your computer. To do so, start a fresh Rstudio session and type the following command in the console:
remotes::install_github("mahendra-mariadassou/learningr")
This package is intended for use with learnr
:
library(learnr)
You should only launch one tutorial at the time. Before launching a new tutorial, restart R.
## Launch only one tutorial at the time!!
learnr::run_tutorial("01_programming_basics", package = "learningr")
learnr::run_tutorial("03_visualisation_basics", package = "learningr")
learnr::run_tutorial("02.1_random_variables", package = "learningr")
learnr::run_tutorial("02.2_classical_distributions", package = "learningr")
learnr::run_tutorial("02.3_bivariate_statistics", package = "learningr")
learnr::run_tutorial("04.1_exploratory_data_analysis", package = "learningr")
learnr::run_tutorial("04.2_barcharts", package = "learningr")
learnr::run_tutorial("04.3_histograms", package = "learningr")
learnr::run_tutorial("04.4_boxplots", package = "learningr")
learnr::run_tutorial("04.5_scatterplots", package = "learningr")
learnr::run_tutorial("04.6_linegraphs", package = "learningr")
learnr::run_tutorial("05.1_tibbles", package = "learningr")
learnr::run_tutorial("05.2_isolating_data", package = "learningr")
learnr::run_tutorial("05.3_summaries", package = "learningr")
learnr::run_tutorial("06.1_sampling", package = "learningr")
learnr::run_tutorial("06.2_testing", package = "learningr")
learnr::run_tutorial("07.1_reshape_data", package = "learningr")
learnr::run_tutorial("07.2_separate_columns", package = "learningr")
learnr::run_tutorial("07.3_join_datasets", package = "learningr")
If you have an error when launching a vignette (it may happen on Windows with R 4.0.0), try this syntax (illustrated on the first vignette):
rmarkdown::run(file = NULL,
dir = learnr:::get_tutorial_path("01_programming_basics",
package = "learningr"),
shiny_args = list(launch.browser = 1))
Instructions for the homework are available on Moodle.
The main file is a Rmd (similar to a jupyter notebook). You must write R code in code chuncks.
You should knit the document to an html file once to get the raw results. You can do so by clicking on the knit button.
You can also execute each chunck in the console (like in a Jupyter notebook) using the small green triangle (note that you should execute chuncks in turn as a chunck may depend on the result of previous chuncks).
When you’re done adding comments and editing the document (for example, hiding some output from the final reports), you should knit it to a html file and submit the Rmd (not the html) to moodle.