search_rows: Search All Rows Across Columns of a Matrix-like Structure

View source: R/search_rows.R

search_rowsR Documentation

Search All Rows Across Columns of a Matrix-like Structure

Description

I sometimes need to see which rows of a matrix-like structure contain a string matched by a search pattern. This somewhat similar to writing a matrix-like structure to disk and then using search_files on it.

Usage

search_rows(x, pattern = ".*", include_row_names = TRUE)

Arguments

x

A matrix or data.frame.

pattern

A pattern.

include_row_names

Include row names into the search?

Value

All rows where the pattern was found in at least one column.

See Also

Other searching functions: compare_vectors(), file_modified_last(), find_files(), fromto(), grep_file(), missing_docs, search_files(), summary.filesearch()

Examples

p <- "\\<4.0[[:alpha:]]*\\>"
search_rows(x = mtcars, pattern = p)
search_rows(x = mtcars, pattern = p, include_row_names = FALSE)
try(search_rows(x = mtcars, pattern = "ABC"))

fritools documentation built on Nov. 19, 2023, 1:06 a.m.