Package 'likingInitiative'

Title: Access the Liking Rating Database
Description: Download and work with the Liking Rating Database, a curated collection of subjective liking ratings from published decision-making studies, described in Fernandez, Goyal and Krajbich (2026) <doi:10.5281/zenodo.22216442>. Data is read from versioned release files and cached for the session, so a pinned version returns the same rows regardless of when it is run. Provides access by dataset, by item across studies, or as the whole corpus, together with the metadata and citations needed to report it.
Authors: Kianté Fernandez [aut, cre, cph]
Maintainer: Kianté Fernandez <[email protected]>
License: MIT + file LICENSE
Version: 0.2.2
Built: 2026-10-16 07:46:45 UTC
Source: https://github.com/liking-initiative/likinginitiative-r

Help Index


BibTeX for a dataset's source publication

Description

BibTeX for a dataset's source publication

Usage

bibtex(x, ...)

Arguments

x

A dataset from get_dataset().

...

Unused.

Value

A character string holding a BibTeX entry.

Examples

bibtex(get_dataset("leeholyoak2021"))

Report on the local asset cache

Description

Shows where downloaded release files are kept, how much space they use, and which versions are present.

Usage

cache_info()

Value

A list, invisibly, with path, bytes and versions.

Examples

cache_info()

Citation text

Description

Please cite both the database and the study whose data you used.

Usage

cite(x, ...)

Arguments

x

A dataset or item from get_dataset() / get_item(). With no argument, returns the citation for the database itself.

...

Unused.

Value

A character string.

Examples

cite()

Delete cached release files

Description

Delete cached release files

Usage

clear_cache(version = NULL)

Arguments

version

Version to remove. NULL (default) clears every version.

Value

Invisibly, the number of bytes freed.

Examples

clear_cache()

Download one or more datasets

Description

Reads a dataset's ratings from the release, with the metadata needed to interpret them.

Usage

get_dataset(dataset, version = "latest", timepoint = NULL)

Arguments

dataset

A dataset code ("leeholyoak2021"), a unique prefix, a dataset id, or a character vector of them.

version

Release version, or "latest".

timepoint

Optional rating phase to keep.

Details

Two datasets repeat their rating phase – leeholyoak2021 (phases 1-3) and leehare2023exp2 (phases 1-2). For those, subject_id and item_id together are not unique; include timepoint, or pass the timepoint argument to take a single phase.

Value

An object of class likingInitiative_dataset with elements data (a tibble), metadata, dataset_code and version. For several datasets, a named list of them.

Examples

d <- get_dataset("leeholyoak2021")
head(d$data)
d$metadata$rating_scale_max
cite(d)

One stimulus across every study that used it

Description

The cross-study view. Because the underlying studies use different response scales, compare on normalized_rating, not rating.

Usage

get_item(item, version = "latest")

Arguments

item

An item name, e.g. "kitkat".

version

Release version, or "latest".

Details

Only the first rating phase of a repeated-phase dataset is included, so those studies do not carry extra weight in a cross-study comparison.

Value

An object of class likingInitiative_item with data, datasets and version.

Examples

k <- get_item("kitkat")
k$data

List the datasets in the database

Description

timepoints gives the rating phases a dataset holds. All but two datasets have a single phase; see get_dataset().

Usage

list_datasets(version = "latest")

Arguments

version

Release version, or "latest".

Value

A tibble with one row per dataset.

Examples

list_datasets()

List the stimuli in the database

Description

List the stimuli in the database

Usage

list_items(version = "latest")

Arguments

version

Release version, or "latest".

Value

A tibble with one row per item.

Examples

list_items()

List the publications in the database

Description

List the publications in the database

Usage

list_studies(version = "latest")

Arguments

version

Release version, or "latest".

Value

A tibble with one row per study.

Examples

list_studies()

The whole corpus in one call

Description

The whole corpus in one call

Usage

load_database(version = "latest")

Arguments

version

Release version, or "latest".

Value

A list of tibbles: ratings, studies, datasets, items. Held in memory after the first call.

Examples

db <- load_database()
nrow(db$ratings)

Version, date and headline counts for the release in use

Description

Version, date and headline counts for the release in use

Usage

release_info(version = "latest")

Arguments

version

Release version, or "latest".

Value

A list describing the release.

Examples

release_info()

Keep downloaded files between sessions

Description

By default release files are cached inside the session's temporary directory, so nothing is written outside it and the cache goes away when R exits. Call this to cache in a directory that persists instead, so a later session reuses the files rather than downloading them again.

Usage

use_persistent_cache(dir = tools::R_user_dir("likingInitiative", "cache"))

Arguments

dir

Directory to cache in. Defaults to this package's per-user cache directory, as given by tools::R_user_dir().

Details

The choice lasts for the session. Put likingInitiative::use_persistent_cache() in your .Rprofile to make it the default for every session, and use clear_cache() to remove what it has stored.

Value

The cache directory, invisibly.

Examples

# cache somewhere disposable for the rest of this session
use_persistent_cache(tempfile("likingInitiative-cache-"))