Last active
January 18, 2018 05:22
-
-
Save ColinFay/46f81d813c902043781f7330de745319 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Classic character vector | |
paste0("as",".","numeric") | |
# getting a function | |
get(paste0("as",".","numeric")) | |
# getting and running a function | |
get(paste0("as",".","numeric"))("1") | |
# With objects | |
x <- "as" | |
y <- "is" | |
get(paste0(x,".","numeric"))("1") | |
get(paste0(y,".","numeric"))("1") | |
# Another function | |
action_type_what <- function(action, type, what){ | |
get(paste0(action,".",type))(what) | |
} | |
action_type_what("is", "numeric", "1") | |
action_type_what("as", "numeric", "1") | |
action_type_what("is", "character", 1) | |
action_type_what("as", "character", 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment