help( sum ) strings <- c( "abcd", "cdab", "cabd", "c abd" ) strings args( grep ) grep( pattern="dab", x=strings ) grep( "dab", strings, value=TRUE ) grepl( "dab", strings ) grep( "ab", strings, value=TRUE ) grep( "ab", strings, value=TRUE ) grep( "^ab", strings, value=TRUE ) grep( "ab$", strings, value=TRUE ) strings <- c("abcd", "cdab", "cabd", "c abd", "cd^ab" ) grep( "^", strings, value=TRUE ) grep( "", strings, value=TRUE ) grep( "\\^", strings, value=TRUE ) grep( "\\bab", strings, value=TRUE ) grep( "^ab", strings, value=TRUE ) grep( "\\Bab", strings, value=TRUE ) grep( "ab$", strings, value=TRUE ) grepl( "^ab", strings ) grepl( "\\bab", strings ) condition.01 <- grepl( "^ab", strings ) condition.02 <- grepl( "\\bab", strings ) condition.02 & ! condition.01 strings[ condition.02 & ! condition.01 ] grep( "ab", strings, value=TRUE ) strings grep( "AB", strings, value=TRUE ) args( grep ) grep( "AB", strings, value=TRUE, ignore.case=FALSE ) grep( "AB", strings, value=TRUE, ignore.case=TRUE ) grep( "AB", strings, value=TRUE ) grep( "[ab]|[AB]", strings, value=TRUE ) grep( "[aA][bB]", strings, value=TRUE ) toupper( strings ) args( gsub ) c("finland", "iceland", "michael landon") gsub( "land", "LAND", c("finland", "iceland", "michael landon") ) gsub( "land$", "LAND", c("finland", "iceland", "michael landon") ) strings <- c("ht","hot","hoot","hooot") grep("h*t", strings, value = TRUE) grep("h.t", strings, value = TRUE) strings <- c("ht","hot","hoot","hooot", "hat") grep("h.t", strings, value = TRUE) grep("ho+t", strings, value = TRUE) grep("ho?t", strings, value = TRUE) grep("ho{1,2}t", strings, value = TRUE) grep("ho{2,}t", strings, value = TRUE) grep("ho{2}t", strings, value = TRUE) strings <- c("ded", "dead","dad","deed", "deaad", "deeed" ) grep( "^de|ad$", strings, value=TRUE ) grep( "^d[ea]d$", strings, value=TRUE ) grep( "^d[ea]?d$", strings, value=TRUE ) strings <- c("ded", "dead","dad","deed", "deaad", "deeed","dd" ) grep( "^d[ea]?d$", strings, value=TRUE ) grep( "^d[ea]+d$", strings, value=TRUE ) grep( "^d[ea]{1,2}d$", strings, value=TRUE ) grep( "^d[a-zA-Z]{1,2}d$", strings, value=TRUE ) help( grep ) grep( "^d⁠[[:alnum:]]⁠{1,2}d$", strings, value=TRUE ) grep( "^d[:alpha:]{1,2}d$", strings, value=TRUE ) grep( "^d[[:alpha:]]{1,2}d$", strings, value=TRUE ) grep( "^d[ea]{1,2}d$", strings, value=TRUE ) grep( "^d[ea]{2}d$", strings, value=TRUE ) grep( "^d[ea]{2,}d$", strings, value=TRUE ) grep( "^d['ea']{2,}d$", strings, value=TRUE ) grep( "^d['ea]{2,}d$", strings, value=TRUE ) grep( "^dead$", strings, value=TRUE ) grep( "^d[e][a]d$", strings, value=TRUE ) strings <- c("ded", "dead","dad","deed", "deaad", "deeed","deeaad" ) strings <- c("ded", "dead","dad","deed", "deaad", "deeed","deeaad","daad" ) strings grep( "^d[e][a]d$", strings, value=TRUE ) grep( "^d[e]?[a]d$", strings, value=TRUE ) grep( "^d[e]*[a]d$", strings, value=TRUE ) strings grep( "^d[e]+[a]d$", strings, value=TRUE ) grep( "^d[e]{1,}[a]d$", strings, value=TRUE ) "deeaad" "deaad" strings <- c("ded", "dead","dad","deed", "deaad", "deeed","deeaad","daad","deeead" ) grep( "^d[e]{1,}[a]d$", strings, value=TRUE ) grep( "^d[e]{1,}[a]{1,}d$", strings, value=TRUE ) strings grep( "^d[e]{0,}[a]{1,}d$", strings, value=TRUE ) grep( "^d[e]{1,}[a]{0,}d$", strings, value=TRUE ) grep( "^d[e]{0,}[a]{0,}d$", strings, value=TRUE ) grep( "^d[e]{1,}[a]d$", strings, value=TRUE ) "deeaad" grep( "^d[e]{1,}.d$", strings, value=TRUE ) getwd() usethis::create_package( "montyhall" ) help( sum )