valid.subjects: Include or Exclude Subjects by Criteria

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/ACCELMISSING.R

Description

Select the subjects that have at least 3 complete days (or other criteria). By such criteria, some complete days are dropped if one has only one or two completed days, although some incomplete days are included if the subject has already three or more complete days.

Usage

1
2
valid.subjects(data1, data2, valid.days = 3, valid.week.days = NA, 
valid.weekend.days = NA, mark.missing = 0, keep.7days=TRUE)

Arguments

data1

A list with three data matrix objects, PA, label, and flag, from the initial dataset before any filtering. Check these objects by typing ls(data1).

data2

A list with three data matrix objects, PA, label, and flag, from the output of valid.days(). Check these objects by typing ls(data2).

valid.days

Minimum number of complete days that the subject should have. valid.days=3 is default.

valid.week.days

Minimum number of complete weekdays that the subject should have.

valid.weekend.days

Minimum number of complete weekend days that the subject should have.

mark.missing

If mark.missing = 0 (default), the nonwearing time is marked by 0 while the wearing time is marked by 1 in flag matrix. If mark.missing = 1, it is the opposite.

keep.7days

If keep.7days = TRUE (default), include all 7 days for a valid subject although some days are incomplete. If FALSE, the dataset only includes valid days of valid subjects.

Value

List with the updated PA, label and flag matrix objects.

Author(s)

Jung Ae Lee <jungaeleeb@gmail.com>

References

[1] Lee JA, Gill J (2016). Missing value imputation for physical activity data measured by accelerometer. Statistical Methods in Medical Research.

See Also

valid.days

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(acceldata); attach(acceldata) # read original data
	
# filtering data for valid days
valid.days.out = valid.days(PA, label, flag, wear.hr=8,  time.range=c("09:00","20:59"))
ls(valid.days.out)

# filtering data for valid subjects
x1 = list(PA=PA, label=label, flag=flag) # original data
x2 = valid.days.out                                     # output of valid.days()
valid.sub.out = valid.subjects(data1=x1, data2=x2, valid.days=3)
ls(valid.sub.out)	

accelmissing documentation built on May 2, 2019, 1:44 p.m.