x <- c(4, 8, 15, 16, 23, 42)
mean(x)[1] 18
PUBH 523/623
Your name here
July 15, 2026
This practice is mostly hands-on. You will set up the real folder structure you will use for the rest of the course, create your R Project, write your first .qmd from scratch, and practice loading packages — all skills you will rely on every week.
Topics covered (Lessons 7–10):
.qmd filesWe’re tackling Quarto and .qmd files, even though it comes second in the lesson order. This way you have access to the .qmd as you are working through the rest of the praactice.
.qmdIn 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.
Download this practice .qmd from the course GitHub repository, rename it, and save it in your course folder.
practice_02.qmd from GitHub.Lastname_Firstinitial_Practice_02.qmd (or lastname_firstinitial_practice_02.qmd), replacing with your actual last name and first initial.practice/ folder. You may create a practice_02/ subfolder if you prefer.If you have already done this (you are reading this file in RStudio!), you are all set. Just confirm the file name is correct before moving on.
Scroll to the very top of this file and update the YAML header:
"Your name here" in author: with your actual name.date-modified: "today" is present so the date updates automatically each time you render.Render the document and confirm your name and today’s date appear at the top of the HTML output.
Directly below this callout box, add:
###) with a title of your choice (something about yourself or why you are taking this course)You can use the Source editor or the Visual Editor.
Add your heading and paragraph here:
The code chunk below calculates the mean of a small vector. Adjust the chunk options so that:
Add the appropriate #| options at the top of the chunk. Refer to the chunk options table in Lesson 8 if you need a reminder.
Render this document to HTML and confirm all of the following:
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.
On your computer, create a folder called PUBH_523_26Su or PUBH_623_26Su somewhere that makes sense (your Documents folder, OneDrive, etc.). Inside it, create the following subfolders (feel free to change some of the subfolders if you have a preferred organization):
PUBH_523_26Su/
├── admin/
├── data_lessons/
├── data_practice/
├── data_project/
│ ├── data_raw/
│ └── data_processed/
├── lessons/
├── practice/
├── project/
└── README.txt
README.txt as a plain text file (open Notepad on Windows or TextEdit on Mac, save as .txt).data_raw/ and data_processed/ inside the data_project/ folder.Take a screenshot of your PUBH_523_26Su folder open in your file browser (Finder on Mac, File Explorer on Windows) so that the subfolders are visible and insert in this .qmd.
New skill: inserting an image into a .qmd
Quarto makes it easy to embed images using Markdown syntax. Here is how:
Step 1. Save your screenshot somewhere you can find it, ideally in your practice/ folder where you create a practice_02 subfolder. You can name something like practice_02_folders.png.
Step 2. In this .qmd file, insert the image.

here() does not work for image pathsStep 3. Render the document and confirm the screenshot appears in the HTML output.
In Lesson 9, we learned to use pacman::p_load() to install and load packages in one step. In the code chunk below, use pacman::p_load() to load all of the following packages:
tidyverse, here, readxl, haven, writexl, janitor, rstatix, gt, gtsummary, naniar
If pacman itself is not installed yet, run install.packages("pacman") in your Console first (just once, do not put install.packages() in your .qmd!).
Fill in the table below. Each package belongs to one of three categories from Lesson 9: loading/saving data, summarizing/visualizing data, or wrangling data. Note one specific thing each package is used for.
| Package | Category | One thing it is used for |
|---|---|---|
here |
||
readxl |
||
haven |
||
janitor |
||
gtsummary |
||
dplyr (part of tidyverse) |
||
ggplot2 (part of tidyverse) |
You can use the ? command in R to learn more about what a package does.
You can also search online for each one! A quick Google search of gtsummary shows me a page on the package
Write your answer here.
We learned that an R Project (.Rproj file) sets the working directory automatically so you never need setwd().
Create an R Project inside your existing PUBH_523_26Su folder and open this .qmd from within it.
PUBH_523_26Su or PUBH_623_26Su folder.qmd from within the project (use the Files pane or File → Open File)Your folder should now contain a PUBH_523_26Su.Rproj or PUBH_623_26Su.Rproj file at the top level. From now on, always start your work by clicking this .Rproj file to open RStudio.
If you already created your R Project, just make sure you opened this .qmd from within it. You can check the top-right corner of RStudio — it should show your project name, not “Project: (None)”.
Paste your getwd() output here:
Example: “/Users/yourname/Documents/PUBH_523_26Su”
Now run getwd() inside a code chunk and render the document. Does the output match what you pasted in Part B? Write 1–2 sentences explaining what you observe.
Remove the #| eval: false line from the chunk below so that it runs and displays output when you render.
Write your answer here.
setwd()?In 1–2 sentences, explain why you should not use setwd() in your .qmd files, and what you should do instead.
Write your answer here.
here() for file pathshere()Run the following code chunk and render the document. Does the output match your getwd() output from Question 4 Part B? Explain in 1 sentence why they match.
Remove the #| eval: false line from the chunk below so that it runs and displays output when you render.
Write your answer here.
here()Imagine you saved a data file called survey_data.csv in your data_practice/ folder. Fill in the here() call below to build the path to that file, then run the chunk to confirm the path looks correct.
Which path style do you prefer and why? (1–2 sentences)
Write your answer here.
Explain in 2–3 sentences: what problem does here() solve that an R Project alone does not fully fix? Think about what happens when you run code in the Console versus when you render a .qmd.
Write your answer here.
If having a checklist helps you stay organized, check off each item below as you complete it. You do not need to submit this checklist.
I used GenAI (Claude) to help me draft this practice assignment. It helped me brainstorm ideas for the assignment, and I directed it to help you complete the needed tasks that I showed in the lessons.
The submission checklist was Claude’s idea. I really like it! Let me know what you think!