count_vars: Count the amount of a particlar response that respondents...

Description Usage Arguments

View source: R/count_vars.R

Description

Count the amount of a particlar response that respondents have across a group of vars.

Usage

1
2
count_vars(df, vars, response = 1, idname = "id", colname = "value",
  vectorize = FALSE)

Arguments

df

dataframe. The data to be transformed.

vars

character. A vector of variables to check.

response

character. The value of the response that you want to count. Defaults to 1.

idname

character. The name of the variable in the dataframe where respondent ids are kept. Defaults to 'id'.

colname

character. The output will be a two-column dataframe with ids and values. The names are the idname for ids and this (default 'value') for the values.

vectorize

logical. If false, the output will be a dataframe. If true, the output will instead be just a vector of the values.


peterhurford/surveytools2 documentation built on Feb. 18, 2021, 9:13 p.m.