The openesm package provides programmatic access to the openESM database, a collection of harmonized Experience Sampling Method (ESM) datasets (openesmdata.org). It enables researchers to discover, download, and work with ESM data while ensuring proper citation and license compliance.
Install the released version from CRAN:
install.packages("openesm")
Or install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("openesm-project/openesm-r")
library(openesm)
# List all available datasets
datasets <- list_datasets()
print(datasets)
# View specific dataset information
datasets[1, ]
# Download a single dataset
data <- get_dataset("0001")
# Access the data
head(data$data)
# View metadata
data$metadata
# Download multiple datasets
multiple_data <- get_dataset(c("0001", "0002"))
# Get citation information
cite(data)
# Additional notes
notes(data)
# View cache information
cache_info()
# Clear cache
clear_cache()
Each dataset is returned as an S3 object containing:
data: A tibble with the ESM observationsmetadata: List with dataset information including sample size, study design, and variable descriptionsdataset_id: Unique dataset identifierversion: Dataset version numberWhen using datasets from the openESM database, please cite the original publication(s) for a specific dataset. The cite() function provides properly formatted citations for both.
This package is licensed under the MIT License. Individual datasets may have different licenses - check the metadata for each dataset.
Please report bugs and request features at https://github.com/openesm-project/openesm-r/issues.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.