fetch_var_by: Fetches the values of one variable where a second variable is...

Description Usage Arguments

Description

Fetches the values of one variable where a second variable is a certain value.

Usage

1
fetch_var_by(var, select_list, col = 3, na.rm = TRUE, data = get_data())

Arguments

var

character. The name of the variable you want values returned for.

na.rm

logical. Whether or not to remove NA and NA-like values.

select_list.

A list of all subselections, with the name of the variable to subselect by and the value it should be (e.g., list('student' = 'Yes'))

col.

3 (default) to grap values, 2 to grab the variable name, 1 to grab the ids, or 'all' to grab the entire data frame for that variable.

data.

The data to grap values from. This is assumed to be a three column melted dataframe, using reshape2 <http://cran.r-project.org/web/packages/reshape2/index.html>. The first column should contain IDs, the second column should contain variable names, and the third column should contain variable values.

e.g., to return the favorite food of people from the city of Paris: fetch_var_by(favorite_food, home_city, 'Paris', data)


peterhurford/surveytools documentation built on May 25, 2019, 1:51 a.m.