For today’s class, make sure to download to your computer the folder called part_05, and then open RStudio by double-clicking on the file called part_05.Rproj.
Please fill out the post-class survey to provide feedback. Thank you!
Homework
See OneDrive folder for homework assignment.
HW 5 due on 2/14.
See the updated HW 5 assignment on OneDrive called hw_05_b526_v2.qmd
Recording
In-class recording links are on Sakai. Navigate to Course Materials -> Schedule with links to in-class recordings. Note that the password to the recordings is at the top of the page.
species island bill_length_mm bill_depth_mm
Adelie :152 Biscoe :168 Min. :32.10 Min. :13.10
Chinstrap: 68 Dream :124 1st Qu.:39.23 1st Qu.:15.60
Gentoo :124 Torgersen: 52 Median :44.45 Median :17.30
Mean :43.92 Mean :17.15
3rd Qu.:48.50 3rd Qu.:18.70
Max. :59.60 Max. :21.50
NA's :2 NA's :2
flipper_length_mm body_mass_g sex year
Min. :172.0 Min. :2700 female:165 Min. :2007
1st Qu.:190.0 1st Qu.:3550 male :168 1st Qu.:2007
Median :197.0 Median :4050 NA's : 11 Median :2008
Mean :200.9 Mean :4202 Mean :2008
3rd Qu.:213.0 3rd Qu.:4750 3rd Qu.:2009
Max. :231.0 Max. :6300 Max. :2009
NA's :2 NA's :2
long_bill4
long_bill3 long medium short NA_
long 57 0 0 0
medium 0 185 0 2
short 0 0 100 0
separate()
Different ways of using the function separate, it was a bit unclear that when to use one or the other or examples of my research data where it’ll be most relevant to use.
Choosing the “best” way of using separate() is overwhelming at first.
I recommend starting with the simplest use case with a string being specified in sep = " ":
separate(data, col, into, sep = " ")
Which of the various versions we showed to use depends on how the data being separated are structured.
Most of the time I have a simple character, such as a space (sep = " ") or a comma (sep = ",") that I want to separate by.
If the data are structured in a more complex way, then one of the stringr package options might come in handy.
here::here()
TSV files, very neat… But also, I got a bit confused when you did the render process around 22:00-23:00 minutes. Also, “here: and also”here” Directories/root directories. I was a bit confused about in what situations we would tangibly utilize this/if it is beneficial.
Great question! This is definitely not intuitive, which is why I wanted to demonstrate it in class.
The key is that
when rendering a qmd file the current working directory is the folder the file is sitting in,
while when running code in a file within RStudio the working directory is the folder where the .Rproj file is located.
This distinction is important when loading other files from our computer during our workflow, and why here::here() makes our workflow so much easier!
what functions will only work within another function (generally)
I’m not aware of functions that only work standalone within other functions. For example, the mean() function works on its own, but can also be used within a summarise().