tom-metherell / early-life-mh-sleep

supporting data for the paper "Associations between early-life mental health and abnormal sleep duration in midlife: findings from a prospective cohort study in Great Britain".

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Associations between early-life mental health and abnormal sleep duration in midlife: findings from a prospective cohort study in Great Britain

This repository contains the supplementary data for the paper "Associations between early-life mental health and abnormal sleep duration in midlife: findings from a prospective cohort study in Great Britain" (preprint available at https://doi.org/10.1101/2023.12.13.23299897).

Please review the licensing information at LICENCE.md and THIRDPARTY.md before reusing any software in this repository.

1. Introduction

There are a number of steps to the analysis. The underlying raw data are available free of charge as follows:

Check the code for the file structure used to store the raw data, or you can store the data elsewhere and change the filepaths present in the code.

2. Deriving sleep durations from accelerometry

These R markdown (.Rmd) scripts were rendered separately and do not use the renv environment present in the repository. Use R version 4.2.0.

3. Cleaning survey data, incorporating sleep estimates and performing regressions

These steps use the targets framework and renv environment present in the repository. After producing or acquiring the derived sleep estimates, you can run these steps by running targets::tar_make() in R 4.2.0 inside the repository. The mice_report and models_report Quarto files are rendered automatically as part of the {targets} pipeline, and the output .html files are also provided in the repository.

4. Plots

Because of technological limitations, the plots must be rendered separately after the completion of the cleaning and analysis steps by rendering the Quarto file 4_plots.Qmd. Use R version 4.2.0 and the renv environment present in the repository. The output .html file and the plot .svg and .png files are also provided in the repository.

5. Supplementary information

The data tables listed in the supplementary information can be accessed by rendering the Quarto file 5_supplementary_info.Qmd. Use R version 4.2.0 and the renv environment present in the repository. The output .html file is also provided in the repository.

Accessing additional raw model outputs

Once you have completed step 3, you can access all raw model outputs, intermediate datasets and summaries using the targets::tar_read() function. For more details, see the {targets} package documentation.

About

supporting data for the paper "Associations between early-life mental health and abnormal sleep duration in midlife: findings from a prospective cohort study in Great Britain".

License:Other


Languages

Language:HTML 94.5%Language:R 3.0%Language:JavaScript 2.5%