sum_weights: sum_weights()

Description Usage Arguments Value Examples

Description

This is a helper function that sums question weights from surveys to compute a total score. The data comes from the following ETO Results report: "[Admin] raw_touchpoint_report_detailed".

Usage

1
2
3
sum_weights(tp_data, var = c("subject_id", "date", "answer_id", "question_id",
  "question_short", "answer_weight"), weight_var = "answer_weight",
  weight_id = "^q", group_var = c("subject_id", "answer_id"))

Arguments

tp_data

dataframe: a dataframe containing touchpoint data."[Admin] raw_touchpoint_report_detailed"

var

character vector: column names to keep for calculations

weight_id

character: pattern that identifies the question to be included in the sum of weights. Can be a regular expression.

Value

dataframe

Examples

1
2
3
4
5
tp <- laycUtils::load_txt('./my_data_folder/touchpoints.txt')
tp <- laycUtils::format_data(tp)
tp <- tp[tp$tp_name == "jrt pre-/post test", ]

sum_weights(tp_data = tp)

thelayc/laycOutcomes documentation built on May 31, 2019, 9:16 a.m.