Learn R Programming

str2str (version 0.2.1)

is.row.names: Test for `row.names`

Description

is.row.names returns whether elements of a character vector are row.names of an object.

Usage

is.row.names(nm, x)

Value

TRUE for every element of `nm` that is a row.name of x and FALSE otherwise. The structure is a logical vector with length = length(`nm`) and names = `nm`. See details for special cases.

Arguments

nm

character vector.

x

object whose row.names are desired to be tested.

Details

If the object does not have any row.names, then the function will return `FALSE` for each element of the character vector. As a reminder, row.names does not respond to a manually added "row.names" attribute (e.g., to a vector). If this is tried, then is.row.names will return `FALSE` for each element `nm`.

Examples

Run this code
data("mtcars")
is.row.names(x = mtcars, nm = c("Mazda RX4","mazda RX4"))

Run the code above in your browser using DataLab