I have a large dataset and am trying to search through it for keywords. Doing this interactively, I've been using grep
alike so:
fee <- grep("fi", fo$fum)
View(fi$fum[fee, ])
This works well enough for my purposes but it has a lot of repetitive typing. I figured I would speed up the process a little by writing a function:
giant_search <- function(x, y) {
y <- grep(quote(x), fo$fum)
return(y)
View(fo$fum[y, ])
}
When I use this function, however, y returns no values (so, of course, View doesn't show anything either). However if I write the exact same code outside of the function it works exactly as I want/expect it to.
I assume the issue is with how R deals with function arguments or strings within a function, but I cannot figure out how to fix the problem.