Last active
March 10, 2019 19:50
-
-
Save tylerlittlefield/7b2f0ec8ccad0cdac521ef5f51833ada to your computer and use it in GitHub Desktop.
For question about vectorization
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
rx_literal2 <- function(.data = NULL, ... ) { | |
stopifnot( | |
length(unique(sapply(list(...), length))) == 1 | |
) | |
args <- sapply(list(...), function(x) if(inherits(x, "rx_string")) x else sanitize(x)) | |
apply(args, 1, paste, collapse="") | |
} | |
rx_literal2(c("!", "@"), c("abc", "!")) | |
#> [1] "!abc" "@!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment