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
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
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Actigraphy)
Loading required package: fda
Loading required package: splines
Loading required package: Matrix
Attaching package: 'fda'
The following object is masked from 'package:graphics':
matplot
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Actigraphy/fda.matchid.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fda.matchid
> ### Title: Match IDs from Clinical and Actigraph Data
> ### Aliases: fda.matchid
>
> ### ** Examples
>
> data(act_29pt)
> data(clinic_29pt_ahi)
>
> colnames(act_29pt) <- sub("X", "", colnames(act_29pt))
> data <- as.matrix(act_29pt[,-1])
>
> ### Example 1: Continuous Covariate
> matchida <- fda.matchid(data, clinic_29pt_ahi, "contin")
>
>
> ### Example 2: Categorical Covariate
> ahi <- clinic_29pt_ahi
>
> 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"))
>
>
>
>
>
> dev.off()
null device
1
>