Skip to content

A clone of the Mediapulse tv-package for demonstration purpose.

Notifications You must be signed in to change notification settings

rluech/tv-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TV

An R-package to analyze Mediapulse TV rawdata

RL: on Windows in R

rm(list = ls())
setwd('~/tv/pkg')
roxygen2::roxygenise('~/tv/pkg/tv')
system('cd C:/Users/rlue/Documents/tv/pkg')
system('Rcmd build tv')
system('Rcmd INSTALL tv_1.0.tar.gz')
file.remove('~/tv/pkg/tv_1.0.tar.gz')

DLC: on Mac in terminal

cd /Users/mediapulse/prog/tc-current/sc/git/
R CMD build tv
R CMD check tv # .id expected to be an issue
R CMD INSTALL tv_1.0.tar.gz

rm -rf tv.Rcheck
rm -rf tv_1.0.tar.gz

in R

library(tv)

calculate standard facts for 10 days

setup('2018-01-01', 10, dem.join = TRUE, import = TRUE)
calc(view)

##            day sample universe    n      dur     rchT     rchP     rtgT      rtgP share
##  1: 2018-01-01   4611 7365.020 3302 86111714 5436.859 73.82002 996.6634 13.532392   100
##  2: 2018-01-02   4526 7365.024 3141 68594841 5071.812 68.86348 793.9218 10.779623   100
##  3: 2018-01-03   4521 7365.023 3234 66067986 5249.206 71.27209 764.6758 10.382531   100
##  4: 2018-01-04   4520 7365.020 3205 66304053 5198.299 70.58093 767.4080 10.419633   100
##  5: 2018-01-05   4567 7365.024 3220 63717528 5228.727 70.99403 737.4714 10.013157   100
##  6: 2018-01-06   4575 7365.023 3263 77119695 5241.892 71.17279 892.5891 12.119299   100
##  7: 2018-01-07   4570 7365.014 3437 84797454 5555.243 75.42746 981.4520 13.325867   100
##  8: 2018-01-08   4509 7365.021 3151 56183973 4996.625 67.84264 650.2775  8.829269   100
##  9: 2018-01-09   4507 7365.016 3157 57344305 5013.564 68.07269 663.7072  9.011620   100
## 10: 2018-01-10   4521 7365.018 3128 53754022 4931.781 66.96224 622.1530  8.447407   100

the same, for non-interactive programming and more educative

id <- setup('2018-01-01', 10)
data <- import(id)

dem  <- data$dem
view <- data$view
prog <- data$prog

join <- view[dem, on = c('day','pin')]
calc(join, by = 'day')

##            day sample universe    n      dur     rchT     rchP     rtgT      rtgP share
##  1: 2018-01-01   4611 7365.020 3302 86111714 5436.859 73.82002 996.6634 13.532392   100
##  2: 2018-01-02   4526 7365.024 3141 68594841 5071.812 68.86348 793.9218 10.779623   100
##  3: 2018-01-03   4521 7365.023 3234 66067986 5249.206 71.27209 764.6758 10.382531   100
##  4: 2018-01-04   4520 7365.020 3205 66304053 5198.299 70.58093 767.4080 10.419633   100
##  5: 2018-01-05   4567 7365.024 3220 63717528 5228.727 70.99403 737.4714 10.013157   100
##  6: 2018-01-06   4575 7365.023 3263 77119695 5241.892 71.17279 892.5891 12.119299   100
##  7: 2018-01-07   4570 7365.014 3437 84797454 5555.243 75.42746 981.4520 13.325867   100
##  8: 2018-01-08   4509 7365.021 3151 56183973 4996.625 67.84264 650.2775  8.829269   100
##  9: 2018-01-09   4507 7365.016 3157 57344305 5013.564 68.07269 663.7072  9.011620   100
## 10: 2018-01-10   4521 7365.018 3128 53754022 4931.781 66.96224 622.1530  8.447407   100

About

A clone of the Mediapulse tv-package for demonstration purpose.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages