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
)A database connection object created by connect_to_peekbank()
Local directory path where stimulus images will be saved (default: "stimulus_data")
Character vector of dataset names to download stimuli for. If empty (default), downloads stimuli for all datasets.
skip downloading a file if a file with that name already exists in that path locally
show debug prints
Maximum number of retry attempts for server errors (default: 3)
Delay in seconds between retry attempts (default: 5)
Returns the stimulus df with an additional column for the paths of the downloaded stimuli
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"))
} # }