Skip to contents

Export events, 1 second EPOCH, daily summary, and wear period averages data sets to subject specific folders.

Usage

write_events(x, subject, trimester, file = NULL, ...)

write_1s_epoch(x, subject, trimester, file = NULL, ...)

write_daily(x, subject, trimester, file = NULL, ...)

write_avgs(x, subject, trimester, file = NULL, ...)

write_all_avgs(x, subject, trimester, 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.

file

Either a path to a file, a connection, or literal data (either a single string or a raw vector). The default value is NULL, which uses the subject and trimester parameters to find the appropriate filename.

...

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

  • _eventsfile.csv for events data to be exported with write_events,

  • _1secepoch.csv for 1 second EPOCH data to be exported with write_1s_epoch,

  • _daily_values.csv for the daily wear data to be exported with write_daily, and

  • _weekly_avgs.csv for the averages data to be exported with write_avgs

by using the loc() function. As the purpose of these functions are to work in the background of the process_data() function, a filename should only be specified when write_(datatype) is used outside of the process_data(), usually for individual examination of problematic data.

In this collection of write_(datatype) functions, the write_all_avgs function performs more tasks than simply writing a data set. This function looks for data sets that already exists within the project directory that contains a collection of wear period averages based on the site given by the subject parameter. For Pregnancy 24/7, the data sets file names are

  • weekly_avgs_IOWA.csv for The University of Iowa,

  • weekly_avgs_PITT.csv for University of Pittsburgh, and

  • weekly_avgs_WVU.csv for West Virginia University.

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

Examples

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