Learn R Programming

rtemis (version 1.4.3)

getnames: Get names by string matching or class

Description

Get names by string matching or class

Usage

getnames(
  x,
  pattern = NULL,
  starts_with = NULL,
  ends_with = NULL,
  ignore_case = TRUE
)

getfactornames(x)

getnumericnames(x)

getlogicalnames(x)

getcharacternames(x)

getdatenames(x)

Value

Character vector of matched names.

Arguments

x

object with names() method.

pattern

Character: pattern to match anywhere in names of x.

starts_with

Character: pattern to match in the beginning of names of x.

ends_with

Character: pattern to match at the end of names of x.

ignore_case

Logical: If TRUE, well, ignore case.

Author

EDG

Details

For getnames() only: pattern, starts_with, and ends_with are applied sequentially. If more than one is provided, the result will be the intersection of all matches.

Examples

Run this code
getnames(iris, starts_with = "Sepal")
getnames(iris, ends_with = "Width")
getfactornames(iris)
getnumericnames(iris)

Run the code above in your browser using DataLab