This set of notes is for students at Chico State to help build a reference for themselves and future users on how to do tasks in R.
.R
file type is mainly R, all discussion/comments need to be in #comment form.Rmd
) file is like a lab notebook where you can write R code,
.qmd
) file is the new generation of Rmarkdown files. A package is a collection of functions that can be used to do things like create graphics or run advanced models. To get access to these functions you have to load the package by typing
where packagename
is the name of the package you are trying to load. Examples include tidyverse
, here
and janitor
.
.txt
), comma separated values (.csv
) or as Excel files (.xlsx
)If my data set is named AddHealth_Wave_IV.csv and it is located in my data folder, then it can be read into R using the read_csv
function.
Here I am assigning the data set to the name raw
.
At the top of your qmd
file, in the YAML header add the following
Inside the code chunk, at the top, use the hash-pipe to set code chunk options
At the top of your qmd
file, in the YAML header under execute
add lines to disable warning
and message
.
Add \newpage
to a blank line.
This uses div tags. Copy it exactly, then insert your own code chunks.
Expand the y-axis to a number a little larger than your max value using ylim(lower, upper)