Searches a list of dataframes.
search_list.RdTakes a list of dataframes and searches their variables for either a specific variable name or for a string within the variable names.
Arguments
- ls
A list of dataframes
- string
A string, either the exact variable name or something to search for.
- exact
Logical. If
exact = TRUEthensearch_listfinds the exact variable, ifexact = FALSEthensearch_listfinds all variable names containing that string usingstringr::str_detect().- ignore.case
Logical. Determines whether to ignore case when
exact = FALSE.
Examples
files <- list(mtcars = mtcars, iris = iris)
search_list(files, "Sepal", exact = FALSE)
#> file variable
#> 1 iris Sepal.Length
#> 2 iris Sepal.Width
search_list(files, "hp")
#> file variable
#> 1 mtcars hp