Import Actiwatch and sleep diary data.
read_sleep.Rd
Importing the raw CSV (comma-separated values) Actiwatch and sleep diary data based on the current working directory.
Arguments
- file
Either a path to a file, a connection, or literal data (either a single string or a raw vector).
- subject
A character vector denoting the Pregnancy 24/7 subject.
- trimester
A character or integer vector denoting trimester of pregnancy.
- ...
Any other parameters needed for
utils::read.csv()
.
Value
A data.sleep
object is returned, which is a data.frame
that only
includes the raw Actiwatch and sleep diary data for the subject
of interest
during the trimester
of interest based on the temporarily created
id
variable.
Details
The file
argument and any other utils::read.csv()
arguments are
used to read in the CSV Actiwatch and sleep diary data. After the data is
imported, the subject
and trimester
arguments are used to create an id
variable for subject and trimester of interest.
The Pregnancy 24/7 study includes a rewear protocol for subjects that had trouble with there activPAL device. Before selecting the sleep diary data for subject of interest at the trimester of interest, the raw Actiwatch and sleep diary data for the entire samples needs to be examined for the rewear protocol. To better understand the rewear protocol, suppose subject 0001-AB during the first trimester needed to have their data recorded again. For processing purposes, it was assummed if the rewear protocol was initiated then the original wear for the trimester is invalid. Thus, the data from the second wear period during the trimester is the data to use and the original data is not needed. Original wear is denoted with an "O" and rewear is denoted with a "R" after the initials for the subject.
This function does not require that the entire sample of the Pregnancy 24/7
study to be included in the data set import with the file
name. It does
require that the subject and trimeseter of interest is listed in the data
set.