-
-
Save bakerwm/d5ebdee49bcc171bc5a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ATOMIC DATA TYPES IN R | |
# Character | |
first.name <- "Kirk" | |
# Integer | |
age <- 25 | |
# Numeric | |
hourly_wage <- 27.25 | |
# Factor: Categorical variables (take on a limited number of different values). Similar to lookups in Excel/databases | |
office <- factor("NYO", levels = c("NYO", "MUM", "SYD")) | |
# Boolean | |
married <- TRUE | |
# OPERATIONS ON ATOMIC TYPES | |
# Character | |
last.name <- "Davis" | |
full.name <- paste(first.name, last.name) | |
# Integer | |
time.till.retirement <- 60 - age | |
# Numeric | |
weekly.compensation <- 40 * hourly_wage | |
round(hourly_wage, 1) | |
# absolute | |
abs(-39 + 10) | |
# Boolean | |
has.kids <- TRUE | |
# AND | |
married && has.kids | |
# OR | |
married || has.kids | |
# NOT | |
! married |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment