Skip to contents

This function is a wrapper of fetch_iquizoo(), which is used as a helper function to fetch data from the iQuizoo database.

Usage

fetch_data(
  project_id,
  game_id,
  ...,
  what = c("raw_data", "scores"),
  query = NULL,
  suffix_format = "%Y0101"
)

Arguments

project_id

The project id to be bound to the query.

game_id

The game id to be bound to the query.

...

Further arguments passed to fetch_iquizoo().

what

What to fetch. Can be either "raw_data" or "scores".

query

A parameterized SQL query. A default query file is stored in the package, which is often enough for most cases. You can also specify your own query file by this argument. See details for more information.

suffix_format

The format of the date suffix. See details for more information.

Value

A data.frame contains the fetched data.

Details

The data essentially means one of the two types of data: raw data or scores. The raw data is the original data collected from the game, while the scores are the scores calculated by the iQuizoo system. While scores can also be calculated from the raw data, the pre-calculated scores are used to for some quick analysis.

The data is separated by project date, so the table name is suffixed by the project date, which is automatically fetched from the database by this function. You could set the format of the date suffix by suffix_format, although currently you should not need to change it because it probably will not change in the future. Finally, this suffix should be substituted into the query, which should contain an expression to inject the table name, i.e., "{table_name}".