STAT1003 – Statistical Techniques
Dr. Emi Tanaka
Australian National University
These slides are best viewed on a modern browser like Google Chrome on a desktop or laptop. Some interactive components may require some time to fully load.
<- or = or even ->c():double with the class as numericThere are four primary types of atomic vectors: logical, integer, double and character.
TRUE is 1 andFALSE is 0.as.numeric() tries to coerce input to numeric value.A factor in R is a special type of integer vector used typically to encode categorical variables.
str() to see the internal structure of an object in R.data.frame is a special type of a named list where each element of the vector is the same length.
tibble is a Tidyverse version of data.frame in R.data.frame, so all functions that work with data.frame objects will also work with tibble objects.A vector can be subsetted using integers in [].
Logical vectors in [] select elements where logical value is TRUE.
Character vectors select elements based on the name of the vector (if any):
Lists can be subsetted using integers in [] or names with $ or [[ ]].
A data.frame can be subsetted using integers in [ , ] or names with $ or [[ ]].
NA in R denotes missing values – there are in fact different types of missing values (NA_character_, NA_integer_, NA_real_, NA_complex_, NA_Date_, NA_POSIXct_).NA and may need to be handled specially.


STAT1003 – Statistical Techniques