# The absolute path where this project lives on my Mac
pwd/Users/kjhealy/Documents/courses/mptc
This section contains worked examples related to what we’ve been covering. Material for specific weeks can be accessed via the menu. In the examples, you will see both chunks of code and the output the code produces. For instance here are some shell commands:
00_dummy_files
R
README.md
README.qmd
_extensions
_freeze
_motivation.qmd
_quarto.yml
_site
_targets
_targets.R
_variables.yml
_weekly-schedule.qmd
about
assets
assignment
avhrr
content
data
deploy.sh
example
files
html
index.qmd
mptc.Rproj
projects
renv
renv.lock
renv.lock.orig
schedule
seas
site_libs
slides
staging
syllabus
README.qmd
_motivation.qmd
_weekly-schedule.qmd
index.qmd
The command comes first, the output comes second.
59 README.qmd
9 _motivation.qmd
33 _weekly-schedule.qmd
23 index.qmd
124 total
248 ./slides/00-slides-template.qmd
838 ./slides/08-slides-git.qmd
1701 ./slides/04-slides-r-and-quarto.qmd
809 ./slides/05-slides-r-reshaping-data.qmd
1688 ./slides/05-slides-r-dplyr.qmd
1674 ./slides/07-slides-ingesting-data.qmd
458 ./slides/01-slides-bigpicture.qmd
1061 ./slides/03-slides-shell.qmd
547 ./slides/03-slides-filesystem.qmd
570 ./slides/04-slides-ggplot-1.qmd
361 ./slides/01-slides-rstudio-firstlook.qmd
9955 total
You can copy the code used in these examples in one of two ways. First, you can mouse over any code chunk and click the clipboard icon, , that appears.
Second, you can scroll to the top of your screen. You will see “</> Code” written in gray in the right corner. If you click that, you will get a little menu that allows you to hide or show all the code chunks on an example page, and also copy the code for the entire page.
---
title: "Code examples"
engine: knitr
---
This section contains worked examples related to what we've been covering. Material for specific weeks can be accessed via the menu. In the examples, you will see both chunks of code and the output the code produces. For instance here are some shell commands:
```{zsh}
# The absolute path where this project lives on my Mac
pwd
```
```{zsh}
# The directory listing for the top-level folder of this project
ls
```
```{zsh}
# Listing all and only the qmd files at the project's top-level folder
ls *.qmd
```
The command comes first, the output comes second.
```{zsh}
# Get a count of the number of lines in all the qmd files in the root folder
wc -l *.qmd
```
```{zsh}
# Get a count (separately) of the number of lines in every file in the slides folder
find ./slides -name '*.qmd' | xargs wc -l
```
You can copy the code used in these examples in one of two ways. First, you can mouse over any code chunk and click the clipboard icon, {{< fa clipboard >}}, that appears.
Second, you can scroll to the top of your screen. You will see "</> Code" written in gray in the right corner. If you click that, you will get a little menu that allows you to hide or show all the code chunks on an example page, and also copy the code for the entire page.