survey_load_results: load a survey results set

View source: R/survey_load_data.R

survey_load_resultsR Documentation

load a survey results set

Description

survey_load_results loads results set for a given survey. It handles several features:

  • mapping of column names (in the DB) to meaningful names (defined in epiwork.tables)

  • merging with geographic tables (geo parameters set geographic level to use)

  • selecting data from a season (automatic table and/or dates bound selection)

Usage

survey_load_results(
  survey,
  cols,
  geo = NULL,
  date = NULL,
  db.table = NULL,
  survey.users = NULL,
  debug = F,
  account = F,
  where = c(),
  season = NULL,
  channel = NULL,
  cols.sup = c(),
  gid = F,
  country = NULL
)

Arguments

survey

: survey name (as defined in epiwork.tables)

cols

column list (you can use aliases)

geo

code for the geo levels to add to the results set (only if the survey contains a geographic column)

date

list(min=,max=) of min and max date to restrict the loaded data (use of the timestamp of the survey)

db.table

override table name (to hanlde backup tables or test table)

survey.users

list of id of SurveyUsers, load data only for these ids

debug

if TRUE show query

account

boolean if TRUE include "account" id (account user id). Only works if "user" column is defined

where

where condition to apply on the query (caution, no check)

season

if not NULL, season number, will load data for a given season, by default load all data from "pollster_results_[survey]"

channel

if not null get data only for a given channel value

cols.sup

supplementary column or SQL select clauses (caution no check)

gid

if TRUE load gid column

country

country name (if survey data has country column)

Details

Note : "global_id" is not used here we use person_id (sequential index of the user = primary key of survey_surveyuser table) instead because it is really cheaper for memory

Value

data.frame data of the survey

See Also

Other survey-load: survey_load_all(), survey_load_options(), survey_load_participants(), survey_load_participations(), survey_load_questions(), survey_load_results_historic(), survey_load_translation(), survey_options_for(), survey_participant_previous_season(), survey_participant_season(), survey_question_id()


cturbelin/ifnBase documentation built on Nov. 5, 2023, 12:54 p.m.