# Setup global settings knitr::opts_chunk$set(message=FALSE, warning=FALSE)
This template follows the preprocessing framework described in Revol and al. (in preparation) and is stored in the esmtools R package. Additional instructions on creating reports and also on preprocessing ESM data can be found on the ESM Preprocessing Gallery website.
Import the packages:
library(esmtools) # For button(), txt() functions library(ggplot2)
This section is dedicated to the first look at the data, the merging of data sources the first basic preprocessing methods (e.g., duplicates, branching items check), and checking the variable consistency when the data has just been imported.
Import the data:
file_path = "path/to/file.csv" data = read.csv(file_path)
Raw dataset info:
read = read.csv esmtools::dataInfo(file_path = file_path, read_fun = read, idvar = "id", timevar = "sent")
r txt(id='esm-issue',title='Issue',text="The issue is that ...",count=TRUE)
r txt('esm-inspect','Inspection',"Here we can see that ...")
r txt('esm-mod','Modification',"I changed ...",TRUE)
r button(text = "Description")
# For instance : # describe(data)
r endbutton()
r button(text = "Supplementary")
r endbutton()
This section is dedicated to checking and solving issues due to inconsistencies between the planned and the actual design of the study.
This section is dedicated to investigating how well participants engaged with the ESM study looking particularly for problematic patterns of behaviors (e.g., invalid observations, response time, careless responding).
This section is dedicated to computing and modifying variables of interest that will later be used in visualization and statistical analysis.
This section is dedicated to examining various aspects of variables (such as distribution) and the differences both within and between participants.
Export the preprocessed data:
file_path_preproc = "path/preprocessed_data.csv" write.csv(data, file_path_preproc, row.names=FALSE)
Run the data quality report:
# Path to the data quality report (.Rmd format) rmark_file = "path/data_quality_report.Rmd" # Name of the output data quality report. Date is included to keep track of changes filename_out = paste0(as.Date(Sys.time()), "_Data_Quality_Report.html") # Knit the data quality report rmarkdown::render(rmark_file, output_file=filename_out, params=list(file_path_preproc=file_path_preproc))
For reproducibility purposes, this section informs about the R session and packages used as well as their versions.
sessionInfo()
Additionally, we display the meta-information of the preprocessed dataset.
esmtools::dataInfo(file_path=file_path_preproc, read_fun = read.csv, idvar="id", timevar="sent")
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.