fetch_var: Fetches values from a melted data frame.

Description Usage Arguments

Description

Fetches values from a melted data frame.

Usage

1
2
fetch_var(var_name, compare = "==", select = NULL, by_id = -1, col = 3,
  na.rm = TRUE, data = get_data())

Arguments

var_name

character. The name of the variable within the data frame to select values from.

compare

character. An operator to compare to the select parameter, if chosen (e.g., "==", ">", ">=", etc.). == by default if select is chosen.

select

character. Returns only values that match this value. Useful for counting. Off by default. the ids, or 'all' to grab the entire data frame for that variable.

by_id

character. The ID of a particular person, if you only want data from that one person. Off by default.

na.rm

logical. Remove all the NA, "N/A", or "" values. On by default.

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.

col.

3 (default) to grap values, 2 to grab the variable name, 1 to grab


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