accel.plot.7days {accelmissing} | R Documentation |
Daily Activity Plot
Description
Displays an individual's physical activity pattern of a day during one week.
Usage
accel.plot.7days(PA, label, flag, time.range = c("00:00", "23:59"),
mark.missing = 0, axis.time = TRUE, save.plot = FALSE,
directory.plot = getwd() )
Arguments
PA |
an N by T matrix including activity counts, where N is the total number of daily profiles, and T is the total minutes of a day (T=1440). |
label |
an N by 2 matrix including the labels corresponding to |
flag |
an N by T matrix with the values of either 1 or 0 which indicating wearing or missing. This matrix can be created from |
time.range |
Define the time range for display. Default is midnight to midnight, which is coded by |
save.plot |
If |
mark.missing |
If |
axis.time |
If TRUE, the x-axis displays the clock times, 8:00, 8:01, 8:02, etc. If FALSE, displays the time index by minute, 481, 482, 483, etc. |
directory.plot |
Directory to save the plots when save.plot=TRUE. If no input, plots are saved to your current directory. |
Value
Plot of activity counts with smoothing curve and missing flag.
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.
[2] Ramsay, J. O., Wickham, H., Graves, S., and Hooker, G. (2014). fda: Functional Data Analysis. R package version 2.4.3.
Examples
data(acceldata2) ; data=acceldata2 # read data before imputation
data(accelimp) # read data after imputation
# plot 7 days before imputation
accel.plot.7days(PA=data$PA[1:7, ], label=data$label[1:7, ], flag=data$flag[1:7, ],
time.range=c("09:00", "20:59"), save.plot=FALSE)
# plot 7 days after imputation
accel.plot.7days(PA=accelimp[[1]][1:7, ], label=data$label[1:7, ], flag=data$flag[1:7, ],
time.range=c("09:00", "20:59"), save.plot=FALSE)
# save the plot
# setwd("yourfolder") #--- set the directory to save plot when save.plot=TRUE
# accel.plot.7days(PA=accelimp[[1]], label=data$label, flag=data$flag,
# time.range=c("09:00", "20:59"), save.plot=TRUE)