find_vars: return variable names in a data frame or environment matching...

Description Usage Arguments Value Examples

View source: R/misc.R

Description

return variable names in a data frame or environment matching some condition

default method

character method

data frame method

find variables

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  find_vars(x, cond = function(x) TRUE)

  ## Default S3 method:
find_vars(x, cond = function(x) TRUE)

  ## S3 method for class 'character'
find_vars(x, cond = function(x) TRUE)

  ## S3 method for class 'data.frame'
find_vars(x,
    cond = function(x) TRUE)

  ## S3 method for class 'environment'
find_vars(x,
    cond = function(x) TRUE)

Arguments

x

a data frame,data frame name in the global workspace or an environment

cond

a function to apply to each column of the data frame Only those matching a returned

Value

a character vector of variable names.

Examples

1
2
library(MASS) # for Cars93 data frame
find_vars(Cars93, cond=is.factor)

jverzani/ProgGUIinR documentation built on May 20, 2019, 5:17 a.m.