Skip to content

mahendra-mariadassou/learningr

Repository files navigation

learningr

binder

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.

Installation

Installing R and other dependencies

You only need to perform each of the following steps once:

  • installing R
  • installing Rstudio
  • installing R packages remotes and learnr

However each of them may take some time.

Installing R

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

Installing RStudio Desktop

Go to the download page. Select, download and install the file corresponding to your OS.

Installing R packages

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

Installing the tutorials

You need to install the tutorials every time there is an update (hopefully not too often)

Installing the tutorials for the first time

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: 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).

Updating the tutorials

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")

Starting a tutorial

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.

Basics of programmings

## Launch only one tutorial at the time!!
learnr::run_tutorial("01_programming_basics", package = "learningr")
learnr::run_tutorial("03_visualisation_basics", package = "learningr")

R and stats

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")

Data visualization

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")

Data manipulation

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")

Estimation and confidence intervals

learnr::run_tutorial("06.1_sampling", package = "learningr")
learnr::run_tutorial("06.2_testing", package = "learningr")

Tidy data

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")

Troubleshooting

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))

Homework

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.

About

Learnr package for L2S4 statistics classes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages