This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
raw.data <-"555-1239Moe Szyslak(636) 555-0113Burns, C. Montgomery555-6542Rev. Timothy Lovejoy555 8904Ned Flanders636-555-3226Simpson, Homer5553642Dr. Julius Hibbert"
name <- unlist(str_extract_all(raw.data, "[[:alpha:]., ]{2,}"))
name
## [1] "Moe Szyslak" "Burns, C. Montgomery" "Rev. Timothy Lovejoy"
## [4] "Ned Flanders" "Simpson, Homer" "Dr. Julius Hibbert"
You can also embed plots, for example:
standard_name <- str_replace_all(str_replace_all(name, "[[:alpha:]]{1,}\\.",""),", "," ")
standard_name
## [1] "Moe Szyslak" "Burns Montgomery" " Timothy Lovejoy"
## [4] "Ned Flanders" "Simpson Homer" " Julius Hibbert"
logic_title <- str_detect(name,"[[:alpha:]]{2,}\\.")
logic_title
## [1] FALSE FALSE TRUE FALSE FALSE TRUE
logic_second_name <- str_detect(str_replace_all(str_replace_all(name, "[[:alpha:]]{2,}\\.",""),", "," "),"[[:alpha:]]{1,}\\.")
logic_second_name
## [1] FALSE TRUE FALSE FALSE FALSE FALSE
price <- "Item1:4$ Item2:5$"
logic_price <- str_detect(price,"[0-9]+\\$")
logic_price
## [1] TRUE
str <- "m 90 f 100 na 10 both 2222 0ppp 22 29b 23232"
str_val <- str_extract_all(str, "\\b[a-z]{1,4}\\b")
str_val
## [[1]]
## [1] "m" "f" "na" "both"
file_name <- "ASASDSDSDStxth.py"
file_val <- unlist(str_extract_all(file_name,".*?\\.txt$"))
file_val
## character(0)
file_name <- "ASASDSDSDStxth.txt"
file_val <- unlist(str_extract_all(file_name,".*?\\.txt$"))
file_val
## [1] "ASASDSDSDStxth.txt"
date_string <- "AAA08/12/1987BBB01/22/1987CCC9/9/19"
date_val <- unlist(str_extract_all(date_string,"\\d{2}/\\d{2}/\\d{4}"))
date_val
## [1] "08/12/1987" "01/22/1987"
eq_string <- "<head>Jey</hea>"
eq_val <- str_extract(eq_string,"<(.+?)>.+?</\\1>")
eq_val
## [1] NA
eq_string <- "<head>Jey</head>"
eq_val <- str_extract(eq_string,"<(.+?)>.+?</\\1>")
eq_val
## [1] "<head>Jey</head>"
input_string <- "clcopCow1zmstc0d87wnkig7OvdicpNuggvhryn92Gjuwczi8hqrfpRxs5Aj5dwpn0TanwoUwisdij7Lj8kpf03AT5Idr3coc0bt7yczjatOaootj55t3Nj3ne6c4Sfek.r1w1YwwojigOd6vrfUrbz2.2bkAnbhzgv4R9i05zEcrop.wAgnb.SqoU65fPa1otfb7wEm24k6t3sR9zqe5fy89n6Nd5t9kc4fE905gmc4Rgxo5nhDk!gr"
numeric_characters <- str_extract_all(input_string,"[[:digit:]]")
numeric_characters
## [[1]]
## [1] "1" "0" "8" "7" "7" "9" "2" "8" "5" "5" "0" "7" "8" "0" "3" "5" "3"
## [18] "0" "7" "5" "5" "3" "3" "6" "4" "1" "1" "6" "2" "2" "4" "9" "0" "5"
## [35] "6" "5" "1" "7" "2" "4" "6" "3" "9" "5" "8" "9" "6" "5" "9" "4" "9"
## [52] "0" "5" "4" "5"
alpha_characters <- str_extract_all(input_string,"[[:alpha:]]")
alpha_characters
## [[1]]
## [1] "c" "l" "c" "o" "p" "C" "o" "w" "z" "m" "s" "t" "c" "d" "w" "n" "k"
## [18] "i" "g" "O" "v" "d" "i" "c" "p" "N" "u" "g" "g" "v" "h" "r" "y" "n"
## [35] "G" "j" "u" "w" "c" "z" "i" "h" "q" "r" "f" "p" "R" "x" "s" "A" "j"
## [52] "d" "w" "p" "n" "T" "a" "n" "w" "o" "U" "w" "i" "s" "d" "i" "j" "L"
## [69] "j" "k" "p" "f" "A" "T" "I" "d" "r" "c" "o" "c" "b" "t" "y" "c" "z"
## [86] "j" "a" "t" "O" "a" "o" "o" "t" "j" "t" "N" "j" "n" "e" "c" "S" "f"
## [103] "e" "k" "r" "w" "Y" "w" "w" "o" "j" "i" "g" "O" "d" "v" "r" "f" "U"
## [120] "r" "b" "z" "b" "k" "A" "n" "b" "h" "z" "g" "v" "R" "i" "z" "E" "c"
## [137] "r" "o" "p" "w" "A" "g" "n" "b" "S" "q" "o" "U" "f" "P" "a" "o" "t"
## [154] "f" "b" "w" "E" "m" "k" "t" "s" "R" "z" "q" "e" "f" "y" "n" "N" "d"
## [171] "t" "k" "c" "f" "E" "g" "m" "c" "R" "g" "x" "o" "n" "h" "D" "k" "g"
## [188] "r"
upper_case_characters <- str_extract_all(input_string,"[[:upper:]]")
upper_case_characters
## [[1]]
## [1] "C" "O" "N" "G" "R" "A" "T" "U" "L" "A" "T" "I" "O" "N" "S" "Y" "O"
## [18] "U" "A" "R" "E" "A" "S" "U" "P" "E" "R" "N" "E" "R" "D"
The secret message is “CONGRATULATIONSYOUAREASUPERNERD”