I can also use a g sub to replace multiple instances of a particular character.
So for example, suppose I have a variable name that has multiple underscores in it.
If I use sub, it will just replace the first underscore.
So, if I say Substitute underscore with nothing in testName.
It'll find the first underscore, replace it, but
leave the next few underscores alone.
If I use gsub, on the other hand, it would replace all of the underscores, so
you just get one variable like this.
You can use that to replace underscores and variable names, so that you have nice,
clean variable names.
Or you can also have this happen in actual,
the text values that you have in your data set.
The next thing that I'm gonna cover is searching for
specific values in variable names, or in variables, themselves.
So here, I'm gonna go back to the camera data, the fixed camera data.
And I'm gonna look at the intersection variable.
So one thing that I might want to be able to do is find all of the intersections
that include the Alameda as one of the roads.
So what I'm gonna do is I'm gonna use the grep function.
The grep will take as input a search string that you wanna look for,
the Alameda, and it will look through this variable and
find all of the instances in that vector where the Alameda appears.