seek: Search Rows/Columns by Name

View source: R/seek.R

seekR Documentation

Search Rows/Columns by Name

Description

Searches rows/columns by name in an array-like object.

Usage

seek_columns(x, ...)

seek_rows(x, ...)

## S4 method for signature 'data.frame'
seek_rows(x, select = NULL, names = NULL, ...)

## S4 method for signature 'matrix'
seek_rows(x, select = NULL, names = NULL, ...)

## S4 method for signature 'data.frame'
seek_columns(x, select = NULL, names = NULL, ...)

## S4 method for signature 'matrix'
seek_columns(x, select = NULL, names = NULL, ...)

Arguments

x

An R object (should be a matrix or a data.frame).

...

Further arguments to be passed to select.

select

A function to be applied to the row/column names (e.g. startsWith()) that returns an integer or logical vector.

names

A character vector of row/column names to look for. Only used if select is NULL.

Value

An integer vector or NULL.

Author(s)

N. Frerebeau

See Also

Other data preparation tools: append_column(), append_rownames(), assign(), compact(), count(), detect(), discard(), get(), keep()

Examples

## Seek columns
seek_columns(iris, select = startsWith, prefix = "Petal")
seek_columns(iris, names = c("Petal.Length", "Petal.Width"))

## Get columns
x <- get_columns(iris, select = startsWith, prefix = "Petal")
head(x)

x <- get_columns(iris, names = c("Petal.Length", "Petal.Width"))
head(x)

tesselle/arkhe documentation built on Feb. 1, 2025, 9:24 a.m.