and the working directory
See the cheatsheet for all the options.
Markdown is a general document format that my documents use and support. It is still a common standard.
Jupyter notebooks were made for doing data analysis in Python.
RMarkdown was made specifically for document types involving built in R script.
Posit introduced quarto that supports working with Python, R, Julia and other languages.
You can change options globally by editing the YAML.
You can change options locally by adding #| in code chunks.
#| echo: True option
#| code-fold: True option
#| eval: True option (default)
Runs the code in the chunk.
#| include: True option (default)
Runs the code and shows the results.
A directory is the current folder R considers when working with your file.
Most computer languages need the directory to be specified so the computer know where to find files.
We have been creating R projects to specify a working directory.
This is the easiest method for maintaining a working directory.
RStudio tells you the working directory in the console.
Here R is looking for files in my /MTH190/Lab 6 folder

If I close the project R will look in the home folder.
File > Close Project

When rendering a quarto document the working directory is automatically set to the folder the quarto document resides in.
This can be confusing. Let’s work through an example.
This will be easiest to follow if you are on the server.
Your console should look like this:
This is a side note:
You can also type getwd() into the console to verify your directory. This shows my home directory is:
"/u00/rstudio_homes/administration.hcc/nschwab"
This is the same as ~
Let’s make a folder and call it practice_wd.
In that folder make a new quarto document.
Notice: Our working directory and the directory our quarto document are in are different.
We’ll leave it that way.
(The easiest way to make them match to to start a new R project in the practice_wd folder)
Make a new chunk and type:
Then render the document.
You should notice that the working directory is in the practice_wd folder.
"/u00/rstudio_homes/administration.hcc/nschwab/practice_wd"
This is confusing for students because while not rendered R is looking for files in the current working directory (home ~) but when rendered R will look in the folder the quarto document is in (~_wd)
This will be a big deal when we read data into the document.
The code below will make a dummy data csv file for practice put it into a code chunk in your practice.qmd file.
Note: It should save to your quarto document’s working directory (~_wd)
Make a new chunk and read in the data.
If you run this chunk you will get an error:
Error: 'dummy_data' does not exist in current working directory ('/u00/rstudio_homes/administration.hcc/nschwab/practice_wd').
When rendering everything works fine.
If the current working directory and the directory for the quarto file match this is not a problem.
This is why we make R Projects before each lab and project.