Skip to contents

Find a column by applying .f to each element in the column, the results of which are summed, and then the column matching criterion is chosen.

Usage

survey_find_column(survey_data, .f, criterion = "max")

Arguments

survey_data

data.frame of survey data

.f

function to apply to each element of survey_data, should return a numeric score

criterion

numeric or "max". If "max" then the first column with a maximum score is chosen, otherwise the first column with a value greater than criterion is chosen.

Value

named integer vector, name is the selected column name and value is its position in survey_data