docs
, data
, and
figs
docs
subfolder as
r_data_types.qmd
In your Quarto document:
vec_1
containing the
following:2, 5, 9, 10, 8, 12, 1, 0
Check the following for that vector:
class()
typeof()
vec_1_e3
vec_1_e1
vec_1_e5to7
vec_1
as a character using
as.character
, stored as vec_1_char
. What does
the output look like?vec_2
vec_2
should contained named elements, where
town = "Santa Barbara
, location = "Rincon"
,
swell = "south"
class()
vec_2_e2
Write code to create a data frame called df_1
that looks
like this:
## region species count
## 1 A otter 12
## 2 B great white 2
## 3 A sea lion 36
## 4 D gray whale 6
count()
column, store as
max_count
Visit the EDI site to learn about Mack Creek salamander & cutthroat trout data you’ll be using here: data package
Download the first CSV listed
(AS00601.csv
), and take a look at it (outside of R is fine
as a first step, e.g. you can open the CSV in Excel)
Explore the metadata (see View Full Metadata in the Resources section of the data website)
What does each column contain? What are the units of each? What is the study overall about?
Create a new Quarto document and save it in your
docs
folder. Attach the tidyverse
,
here
and janitor
packages in the setup chunk
(you choose the file name)
Set global options in the YAML so that messages and warnings do NOT show up in the rendered document
Save the AS00601.csv
in your data
folder of your project
Read in the data using read_csv()
with
here()
, store as mack_verts
Look at what you’ve read in (e.g. with view())
Update the variable names in mack_verts to lower snake case
In a new code chunk, practice accessing individual pieces of the data frame (there is no real functionality to this right now, but just to reinforce stuff we learned in our interactive session):
mc_wt_5
.
Check by looking at your data frame to confirm.mc_length_8_20
. Check by looking at your data frame to
confirm.mc_dates
species
as DITE
). Store the subset as
mc_salamanders
. Hint: see
dplyr::filter()
!Create a scatterplot of length1 (snout-vent length in
millimeters) versus weight (grams) for all salamanders in the subset you
created above, mc_salamanders
. Update axis labels, title,
subtitle, and add a caption with the data source. Customize point color
and size, possibly opacity, and theme.
Export your scatterplot as salamander_size.png
to
your figs folder.
mc_trout
that
only contains observations for cutthroat trout (species “ONCL”)scale_color_manual()
)facet_wrap(~...)
)cutthroat_size.png
to the
figs
folder