I am trying to find if there is a quick way to search for specific strings in arrays in R, kind of like the game Boggle, except you know the word upfront.
You are allowed to move in the following directions for the next letter of the string: up, down, right or left
Say for a simple example you have an array of the form:
> G A, Q, A, Q, Q, A, Q, P, Q, Q, Q, Q, P, L, Q, Q, Q, Q, E, Q
And you want to apply a function to G with the string
APPLE, for the function to return
APPLE exists in this array, and
FALSE if it doesn't.
Does there exist a pre-made function or package that can do this, or alternatively is there a smart way to do it, I'm relatively new to dealing with strings in R and I'm struggling to see a way.
Any help much appreciated. Thanks.