Skip to contents

Export screened subject-specific sleep or nap Actiwatch data to subject-specific directories.

Usage

write_msleep(x, subject, trimester, nap = FALSE, file = NULL, ...)

write_all_msleep(x, subject, trimester, nap = FALSE, file = NULL, ...)

Arguments

x

A data frame or tibble to write to disk.

subject

A character vector denoting the Pregnancy 24/7 subject.

trimester

A character or integer vector denoting trimester of pregnancy.

nap

Logical denoting if nap data is to be imported. Default is FALSE.

file

File or connection to write to.

...

Any other parameters needed for readr::write_csv().

Details

When file is the default value of NULL the subject and trimester parameters along with the current working directory are used to write the files that ends with

  • _napsonly_flag.csv if nap = TRUE and

  • _restonly_flag.csv by default.

These functions performs more tasks than simply writing a data set. The write_all_msleep function looks for data sets that already exists within the project directory that contains a collection of wear period data based on the type of rest (sleep or nap) given by the nap parameter. For Pregnancy 24/7, the data sets file names are

  • master_dataset_napsonly.csv if nap = TRUE and

  • master_dataset_restonly.csv by default.

If these files already exists, then the wear period data for the subject of interest during the trimester of interest is merged with the the existing data set based on the type of rest for the subject.

Examples

# See quality_check() for an example of how these functions are used.