This function downloads stimulus images for selected Peekbank datasets from OSF. It retrieves stimulus metadata from a Peekbank database connection, constructs the full paths to the stimulus images on OSF, and downloads them to a local directory.

download_stimuli(
  con,
  local_base_dir = "stimulus_data",
  datasets = c(),
  skip_existing = T,
  debug = F,
  max_retries = 3,
  retry_delay = 5
)

Arguments

con

A database connection object created by connect_to_peekbank()

local_base_dir

Local directory path where stimulus images will be saved (default: "stimulus_data")

datasets

Character vector of dataset names to download stimuli for. If empty (default), downloads stimuli for all datasets.

skip_existing

skip downloading a file if a file with that name already exists in that path locally

debug

show debug prints

max_retries

Maximum number of retry attempts for server errors (default: 3)

retry_delay

Delay in seconds between retry attempts (default: 5)

Value

Returns the stimulus df with an additional column for the paths of the downloaded stimuli

Examples

if (FALSE) { # \dontrun{
con <- connect_to_peekbank("2025.1")

# Download stimuli for all datasets
download_stimuli(con, local_base_dir = "stimulus_data")

# Download stimuli for specific datasets
download_stimuli(con, local_base_dir = "stimulus_data", datasets = c("reflook_v4", "reflook_socword"))
} # }