fda.matchid: Match IDs from Clinical and Actigraph Data

Description Usage Arguments Details Value Author(s) Examples

View source: R/fda.matchid.R

Description

A function used to match actigraphy data and clinical covariates by subject IDs and return a list of the data combined by IDs. Only the subjects with both actigraphy and covariate data will be returned by this function.

Usage

1
fda.matchid(mat, acov, type, grouplab)

Arguments

mat

A data frame with the rows being the time and the columns being the activity, with the column names being the subjects.

acov

A two column data frame that contains only subject IDs and a covariate of interest, respectively.

type

A string specifying either "contin" for continuous and "factor" for categorical covariates.

grouplab

A vector of names of the categories if type is TRUE.

Details

Note: Only the subjects with both actigraphy and covariate data will be returned by this function.

Value

A list consisting of two components as follows:

mat

A matrix where rows represent the time, columns are the samples, and the column names are the subjects.

cov

A two column matrix that contains the actigraphy data and clinical covariates.

Author(s)

William D. Shannon, Tao Li, Hong Xian, Jia Wang, Elena Deych, Carlos Gonzalez

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
	data(act_29pt)
	data(clinic_29pt_ahi)
	
	data <- act_29pt
	ahi <- clinic_29pt_ahi
	
	### Example 1: Continuous Covariate
	matchida  <- fda.matchid(data, ahi, "contin")
	
	
	### Example 2: Categorical Covariate
	ahi$ahicat <- as.factor(
		ifelse(ahi$AHI >= 0 & ahi$AHI <= 5, 1,
		ifelse(ahi$AHI > 5 & ahi$AHI <= 15, 2,
		ifelse(ahi$AHI > 15 & ahi$AHI <= 30, 3,
		ifelse(ahi$AHI > 30, 4, 0))))
	)
	
	matchidb  <- fda.matchid(data, ahi[,-2], "factor", 
			c("normal", "mild", "moderate", "severe"))

Actigraphy documentation built on March 26, 2020, 6:07 p.m.