Using global regular expression print (grep) and regular expressions (regex) to find character string patterns is a valuable tool in data analysis and is available with all operating systems and many different programming languages. It is a powerful tool once it is understood. The recently developed library(stringr)
package makes these tools much easier to use. The three tasks below can be completed in many different ways. As a challenge, my code to complete this entire task less than 10 lines.
This reading will help you complete the tasks below.
readr::read_lines()
function to read in each string - randomletters.txt and randomletters_wnumbers.txtrandomletters.txt
file, pull out every 1700 letter (e.g. 1, 1700, 3400, …) and find the quote that is hidden - the quote ends with a periodrandomletters_wnumbers.txt
file, find all the numbers hidden and convert those numbers to letters using the letters order in the alphabet to decipher the messagerandomletters.txt
file, remove all the spaces and periods from the string then find the longest sequence of vowels..R
script to your repository and be ready to share your code solution at the beginning of class