install.packages("tidyverse")
library(tidyverse)Practice 2 Answers
PUBH 523/623
Questions
Question 1: Your First Practice .qmd
In Lesson 8, we walked through the three components of a .qmd file: the YAML header, text, and code chunks. In this question, you will demonstrate that you can create, edit, and render a .qmd file correctly.
Part A: Downloading the practice file
Answer:
No answer given, for completion only.
Part B: Check your YAML header
Answer:
No answer given, for completion only.
Part C: Add a heading and paragraph
Answer:
Not given
Part D: Code chunk options
Answer:
echo and warning control these options.
Part E: Render and confirm
Answer:
No answer given, for completion only.
Question 2: Set Up Your Course Folder
In our lesson on folder and file organization (L7), we learned that every project should live in one well-organized folder. In this question, you will create that folder and use it for the rest of the course.
Part A: Create the folder structure
Answer:
No answer given, for completion only.
Part B: Take a screenshot and insert it here
Answer:
Here is the image path to my screenshot:

You will need to make sure your file path takes you to your screenshot.
Question 3: Packages
Part A: Load the course packages
Answer:
No answer given, for completion only.
Part B: What does each package do?
Answer:
Here is the table with select rows filled out
| Package | Category | One thing it is used for |
|---|---|---|
here |
||
readxl |
Loading/saving data | Read Excel (.xlsx) files into R |
haven |
||
janitor |
||
gtsummary |
||
dplyr (part of tidyverse) |
||
ggplot2 (part of tidyverse) |
Summarizing/visualizing data | Create data visualizations using a layered syntax |
Note: other valid answers exist for each package, the above are examples.
Part C: Install vs. load
Answer:
Not given
Question 4: Create Your R Project
We learned that an R Project (.Rproj file) sets the working directory automatically so you never need setwd().
Part A: Create the project
Answer:
No answer given, for completion only.
Part B: Confirm the working directory
Answer:
The output should be the full path to your PUBH_523_26Su (or PUBH_623_26Su) folder.
Part C: Does the working directory match?
Answer:
No, the output will not match.
Part D: Why not setwd()?
Answer:
Not given. Think about absolute file paths vs relative file paths.
Question 5: Using here() for file paths
Part A: Explore here()
Answer:
Should match!
Part B: Build a file path with here()
Answer:
Not given
Part C: Console vs. render
Answer:
Not given