calc_shares: Calculate the weighted share of an answer item

Description Usage Arguments Value Author(s)

Description

This function calculates how often an answer item was selected relatively to the other answer item of a question. The result is given as a share. Besides the function calculates additional information that is described in greated detail below.

Usage

1
  calc_shares(dt, var, sizeColumn)

Arguments

dt

a data.table containing the entire relevant data

var

a character representation denoting a particular column of the data.table given in dt. Typically this column represents a qualitative question. The columns of the data.table to which var refers were tested for factor, integer and character columns.

sizeColumn

a character representation of the data.table column that holds the quantitative weight. If you want to aggregate without weighting hand a vector of 1s which is equal to nrow(dt).

Value

returns a data table that consists of the following columns: - all columns that were keys of the input data.table (this varies depending on the input) typically this is: time, group, question - sumTest: sum of all employees working in key group that chose a particular answer item - sumTestTotal: sum of all employees working in a key sector - AN: number of participants in the key group that chose a particular answer item - ANTot: number of participants in the key group - share: weighted share, sumTest/sumTestTotal

Author(s)

Matthias Bannert


mbannert/gateveys2 documentation built on May 21, 2019, 2:23 p.m.