Week 1 Day 2 Flashcards
What is the R command for equality?
==
What is the R command for inequality?
!=
What is the R command for “is this true AND is this true?”
&
What is the R command for “is EITHER this true OR this true?”
| (not capital I)
(not capital i).
What is the R command for “is this NOT true?”
!
Do all functions in R have an argument?
Yes.
What does this mean: round (4.9384,3)?
Round 4.9384 to 3 decimal places.
Do arguments for R functions also have names?
Yes.
e.g. round () argument, has arguments with the following names: x and digits.
e.g. round ( x = 3.254, digits = 1).
What is “nesting”?
Functions using other functions as arguments.
What are vectors?
Vectors are variables that store multiple bits of information. Think of variables as boxes that store items. Vectors are like a sequence of boxes (variables), which each contain values (inside variables), like a shelf.
How do you create a vector in R?
Using the function c( ).
e.g. theNextThreeYears <- c(2025, 2026, 2027)
Can you have have multiple classes in a vector? e.g. words and numbers, or numbers and logicals?
No. R will convert everything into the same class, but will not let you know. “silent fail”.