household: Aggregate viewing statements within household

Description Usage Arguments Details Value Examples

View source: R/household.r

Description

This function takes the view object and returns it after aggregating viewing statements within each household.

Usage

1
household(view, guest = id$view$guest, hh.calc = id$view$hh.calc)

Arguments

view

The view object, a data.table containing the viewing statements by day and individuals (pin).

guest

logical, including (TRUE) or excluding (FALSE) guest viewing? If not otherwise set, the parameter is taken from id$view$guest, the guest parameter set in setup(guest = ).

hh.calc

'normal' (default) or 'by channel'. If not otherwise set, the parameter is taken from id$view$hh.calc, the type of household caclulation set in setup(hh.calc = ).

Details

Instead of calculating TV viewing on individual level, TV viewing can be aggregated within each household. The Kantar aggregation method is not simply summing up all indidividuals viewing within the household. Rather, the viewing satetments are rebuilt to reflect a household perspective: If more than one person is watching a given content at the same time, the viewing only counts once on household level not multiple times as it would be the case on individuals level. Use setup(obs = c('ind','hh')) to switch level of observation between individual and household ('ind' is default).

By default guest viewing is included when aggregating by houlsehold. To exclude guest viewing use setup(guest = FALSE).library(data.table)

There are two types of Kantar household aggregation methods, namely 'normal' and 'by channel'. For Switzerland the parameter is set to 'normal'. Use setup(hh.calc = c('normal','by channel')) to switch types of household calculation ('normal' is default). This only takes effect if obs is set to 'hh'.

'by channel' means, if two or more person are watching at the same time but different channels, the viewing is aggregated by channel. 'normal' means in such a case the viewing is interpreted as a single viewing statement ignoring that there was different content being watched. If later facts are calculated by channels hh.calc has to be aggregated by channel to macht instar results.

Value

The function returns the view object with viewing statements beeing aggregated within each household. The sum of viewing duration is less than on individual level and the number of viwing statements is less too. The column pin now represents houshold ID.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
setup('01-01-2018', 3, prg = FALSE, import = TRUE) # on individual level
dem.ind <- dem
view.ind <- view
# pin in data.table 'dem' and 'view' reflect indiviual IDs 3 to 6 digit number e.g. 601

setup('01-01-2018', 3, prg = FALSE, obs = 'hh', import = TRUE)
dem.hh <- dem
view.hh <- view
# pin in data.table 'dem' and 'view' reflect household IDs 1 to 4 digit number e.g. 6
# viewing statements are less and different form dem.ind
nrow(view.ind); nrow(view.hh)
sum(view.ind$dur); sum(view.hh$dur)

rluech/tv-clone documentation built on Jan. 7, 2022, 12:27 a.m.