In this video, you'll learn how to write efficient code to iterate through an entire folder, identify and extract a specific string, and unlock the potential of automating your search process. Whether you're a beginner or an experienced R programmer, this tutorial will equip you with the necessary skills to streamline your file analysis and project management tasks, and save valuable time.
I made this video because I've so often encountered situations where I had to repeat the same words, phrases, or numbers in a series of documents, only to have to change them later. We're all human, so it's easy to forget to make changes or miss one or two cases. In the video's example, I changed the number 505 to 510, however, some documents have one or both and are thus not consistent. By identifying the count of 505 in each document, I will know which documents I need to update and change. It is possible to use R to loop through each of these and change 505 to 510, but that is outside the scope of this video. If this is something you would like to see, please let me know. Also, I wanted to show newer users of R what's possible, so I tried to keep the code relatively simple. It is possible to extract strings or numbers from tables, headers, and footers, but that's a bit more advanced. If there's interest, I can make a part 2 video with these abilities.
I am using R Studio in the video, which I highly recommend if you plan to code in R. Make sure to download R first and then R Studio. You will find that R Studio simplifies the process of finishing your syntax, downloading packages and so much more.
Link to R code: https://controlc.com/508d84cc
VIDEO TIMELINE
Intro - 0:00
Overview - 0:06
Opening up R or R Studio - 0:50
Install pdftools and readtext packages - 1:05
Import packages - 1:30
Putting in the rest of the code - 1:39
Running the code - 3:47
Looking at the results - 3:57
Outro - 5:03