This function searches to see if item 'search_for' is within the matrix 'x' and returns a respective TRUE (T) and FALSE (F). This can be useful for adding footnotes, adding conditional text to your document, and much more!
is_something_in_this_matrix(x, search_for)
The matrix that needs to be searched.
Items to be searched for in matrix x.
TRUE or FALSE
x = data.frame(matrix(1:9, nrow = 3, ncol = 3))
x
#> X1 X2 X3
#> 1 1 4 7
#> 2 2 5 8
#> 3 3 6 9
is_something_in_this_matrix(x,
search_for = 9)
#> [1] TRUE
x = data.frame(matrix(LETTERS[1:9], nrow = 3, ncol = 3))
is_something_in_this_matrix(x,
search_for = "J")
#> [1] FALSE