findVariable: Find data frames containing a selected variable names

Description Usage Arguments Details Author(s) Examples

View source: R/findVariable.R

Description

The data frames in a workspace are searched for variable names of interest and a vector of names is returned. The returned vector names the data frames that contain all of the variables of interest.

Usage

1

Arguments

var

A vector of variable names to search for. Only data frames containing all of the variables given will be returned.

Details

This function was written in response to the following query:

"I have a workspace attached in R. it's got objects in it. some of the objects are data frames. I'd like to search the dataframes in the workspace for a variable called THGRP and get a listing of dataframes that contain it. how I do this?"

Author(s)

Benjamin Nutter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
mtcarsA <- mtcars
mtcarsB <- mtcars
mtcarsB$newVar <- 1:nrow(mtcarsB)
IndomethA <- Indometh

findVariable("am")
findVariable(c("am", "mpg"))
findVariable(c("am", "newVar"))
findVariable("time")

# cleanup
rm(list=c('mtcarsA', 'mtcarsB', 'IndomethA'))

nutterb/junkyard documentation built on May 24, 2019, 10:51 a.m.