Set Up

library(learnr)
tutorial_options(exercise.timelimit = 60)

Welcome

This is a demo tutorial. Compare it to the source code that made it.

Outline

This tutorial will help you set up your computer to use R. It is for you if you need to:

You can skip this tutorial if you've already done these things.

Is this tutorial for you?

Do you need to work through the tutorial? Take the quiz below to find out.

question("Check all that you have NOT done:",
  answer("installed R on my computer", message = "* Install R"),
  answer("installed the RStudio IDE", message = "* Install RStudio IDE"),
  answer("installed the tidyverse R package", message = "* Install Packages"),
  answer("None of the above. I've done them all.", correct = TRUE, message = "You can skip this tutorial!"),
  type = "multiple",
  incorrect = "This tutorial is here to help! To get set up read:"
)

Install R

How to install R

Test your knowledge

quiz(caption = "Quiz - Install R",
  question("Is R free to download and use?",
    answer("Yes!", correct = TRUE, message = "R is free _and_ open source, which means that anyone can read, use, and copy the source code of the R language."),
    answer("No.")
  ),
  question("Where do you download R?",
    answer("www.rstudio.com/download"),
    answer("[cloud.r-project.org](http://cloud.r-project.org)", correct = TRUE, message = "You can also download R from [cran.r-project.org](http://cran.r-project.org)"),
    answer("www.r-project.org", message = "Good try, but not exactly. www.r-project.org doesn't provide a download link, but it does provide a link to one the websites above."),
    answer("www.r.com"),
    allow_retry = TRUE
  ),
  question("How often should you update R?",
    answer("Everytime you use it", message = "This will be too often unless you use R very rarely!"),
    answer("About once a year", correct = TRUE, "A new version of R is released about once a year. Update sooner if you encounter a bug that you cannot explain."),
    answer("Never", message = "A new version of R is released about once a year. I'll assume that you are using the newest version of R, which will be the fastest version with the fewest unexpected behaviors." ),
    allow_retry = TRUE
  )
)

Install RStudio

How to install RStudio

RStudio is an Integrated Development Environment for R. What does that mean? Well, if you think of R as a language, which it is, you can think of RStudio as a program that helps you write and work in the language. RStudio makes programming in R much easier and I suggest that you use it!

Test your knowledge

quiz(caption = "Quiz - Install RStudio",
  question("What is the RStudio IDE?",
    answer("An application that makes it easier to use R.", correct = TRUE, message = "RStudio organizes your workspace and makes it easier to write, use, debug, and save R code. I highly recommend it and will rely on the RStudio IDE in several tutorials."),
    answer("An application that let's you use R without writing any code", message = "And thank goodness! Code provides a reproducible record of your work, which is essential for data science."),
    answer("A spreadsheet program like Microsoft Excel."),
    answer("Another name for R", message = "R and RStudio are two separate things. R is a language, like English. Think of RStudio as a program that helps you use the language, kind of like how a word processing program helps you write in English."),
    allow_retry = TRUE
  ),
  question("Is the RStudio IDE free to download and use?",
    answer("Yes!", correct = TRUE, message = "Like R, RStudio is free and open-source. There do exist professional versions of RStudio with enhanced features, but we will not rely on those features in these tutorials."),
    answer("No.", message = "Like R, RStudio is free and open-source. There do exist professional versions of RStudio with enhanced features, but we will not rely on those features in these tutorials.")
  ),
  question("Where do you download RStudio?",
    answer("www.rstudio.com/download", correct = TRUE, message = "For these tutorials, download and install the RStudio Desktop Open Source License."),
    answer("[cloud.r-project.org](http://cloud.r-project.org)", message = "This is where you download R, not RStudio."),
    answer("www.r-project.org"),
    answer("[cran.rstudio.org](http://cran.rstudio.org)"),
    allow_retry = TRUE
  ),
  question("Do you need to install R if you already have RStudio?",
    answer("Yes.", correct = TRUE),
    answer("No.", message = "R does not come with RStudio; you need to install R separately.")
  )
)

Install Packages

How to install R packages

Test your knowledge

quiz(caption = "Quiz - Working with Packages",
  question("What command do you use to install packages?",
    answer("`library()`", message = "We will see what `library()` does later."),
    answer("`install.packages()`", correct = TRUE),
    answer("`install_packages()`"),
    answer("There is no command. You must visit [cran.r-project.org](http://cran.r-project.org) and download packages manually.", message = "R makes it easy to download packages. You connect to the internet and then run one of the commands above."),
    allow_retry = TRUE
  ),
  question("How often do you need to install a package on your computer?",
    answer("Every time you restart R"),
    answer("Every time you restart your computer"),
    answer("Only once. Afterwards, R can find it on your hard drive as needed.", correct = TRUE),
    answer("Never, as long as you are connected to the internet.", message = "This could be true if you are using R over a cloud service. However, if you are using R locally on your own computer, you will need to install each package that you use on your computer."),
    allow_retry = TRUE
  ),
  question("What is the tidyverse?",
    answer("A collection of packages that work well together and provide tools for common data science tasks.", correct = TRUE, message = 'You can install all of the tidyverse packages at once with `install.packages("tidyverse")`.'),
    answer("A word processing program for R"),
    answer("A code style that reads like poetry"),
    answer("An alternate universe where everyone is an R programmer."),
    allow_retry = TRUE
  )
)


Try the learnr package in your browser

Any scripts or data that you put into this service are public.

learnr documentation built on Sept. 28, 2023, 9:06 a.m.