Lecture 8
Duke University
STA 199 - Fall 2022
9/22/22
ae-05 project (from last time) in RStudio, render your document, and commit and push. Make sure you have your “first draft” plot ready to go.HW 2 due tonight (11:59 pm)
Lab 2 due tomorrow night (11:59 pm)
x < y |
test if x less than y |
x <= y |
test if x less than or equal to y |
x > y |
test if x greater than y |
x >= y |
test if x greater than or equal to y |
x == y |
test if x is equal to y |
x != y |
test if x is not equal to y |
is.na(x) |
test if x is NA |
!is.na(x) |
test if x is not NA |
x %in% y |
test if x is in y |
!(x %in% y) |
test if x is not in y |
!x |
test for not x |
x & y |
test for x and y |
x | y |
test for x or y |
is.na() and na.rm?is.na() checks for NAs and returns TRUE or FALSE – it’s a function.
na.rm removes NAs before applying a function – it’s an argument in a function.
ae-05ae-05 project.pivot_longer() function.Type is how an object is stored in memory, e.g.,
double: a real number stored in double-precision floatint point format.integer: an integer (positive or negative)– Class is metadata about the object that can determine how common functions operate on that object, e.g.,
factorYou’ll commonly encounter:
logicalintegerdoublecharacterYou’ll less commonly encounter:
listNULLcomplexrawYes, functions have types too, but you don’t need to worry about the differences in the context of doing data science.
A factor is a vector that can contain only predefined values. It is used to store categorical data.
Just a couple of examples…
ae-06 (repo name will be suffixed with your GitHub name).