Practice Problem Set 1: Introduction

Downloading R and R Studio/Positron

  1. If you don’t have R and R Studio/Positron downloaded, please download them:

    • Download R here.
    • Download RStudio here.
    • Download Positron here.
  2. If you prefer to use RStudio, please create an R project for this class and open that project. Try using the project setup. If using Positron, you don’t need to create a project but you can just set up a folder for this course.

  3. Install the following packages:

    install.packages("tidyverse")
    install.packages("readxl")
    install.packages("janitor")
    install.packages("estimatr")

Working In R

  1. Open an R script.

  2. Look at the sleep data, which is a built in dataset in R.

    sleep
       extra group ID
    1    0.7     1  1
    2   -1.6     1  2
    3   -0.2     1  3
    4   -1.2     1  4
    5   -0.1     1  5
    6    3.4     1  6
    7    3.7     1  7
    8    0.8     1  8
    9    0.0     1  9
    10   2.0     1 10
    11   1.9     2  1
    12   0.8     2  2
    13   1.1     2  3
    14   0.1     2  4
    15  -0.1     2  5
    16   4.4     2  6
    17   5.5     2  7
    18   1.6     2  8
    19   4.6     2  9
    20   3.4     2 10
  3. Using the summary() function from base R, write code to look at the summary of all the variables in the data.

  4. Using the table() function, check the how many records are there for each group.

  5. Run a linear regression regressing extra on group and view the summary of the model.

Working with Quarto

  1. Download Quarto. Create an html Quarto document and write a short paragraph on what you expect to gain out of this course in the next 3 months.

  2. In the document, check where the working directory is now.

  3. Create code snippets on the Quarto document and transfer the code from Question 4 through 8 there.

  4. Render the html file.

Bonus: Version Control

  1. If you don’t have a GitHub account, create an account.

  2. Create a repository for this class and add the R Project you created for this class to the repository.

  3. Commit and push changes to remote repository.