tre: Trelliscope Visualization for Accelerometer Data

Description Usage Arguments Value See Also Examples

View source: R/tre.R

Description

This function generates the data frame necessary for trelliscope visualization.

Usage

1
2
3
tre(lis, id = NULL, varlis = NULL, smband = 1/12, maxday = 14,
  plot.ind = TRUE, plot.ori = TRUE, plot.sm = TRUE,
  plot.tre = FALSE, plot.tre.path = NULL)

Arguments

lis

the list of activity data, with each element corresponding to the observation by one individual and the name of each element coresponding to the individual id. Specifically, each element is a nob by nday matrix, where each column is an observation by day.

id

a vector of id names corresponding to the lis activity data.

varlis

optional data frame to be merged to activity data, and the covariates are of interest for plotting to see activity differences. The first variables needs to be "ID".

smband

smoothing parameter for plotting smoothed activity data. the default is 1/12 (see function lowess).

maxday

maxday the maximal number of days per individual in the observation, used to check the data format. The default is 14.

plot.ind

whether to plot individual mean activity plots. If not, plot day activity plots. The default is TRUE.

plot.ori

whether to plot the original activity curves (tend to have large variations). The default is TRUE.

plot.sm

whether to plot lowess of the activity curves. The default is TRUE.

plot.tre

whether to generate trelliscope plots. If so, no data will be returned; if not, a data frame will be returned containing all information including trelliscope panels. To generate trelliscope based on the data, one needs to set all activity list columns to NULL. The default is FALSE.

plot.tre.path

If plot.tre is TRUE, then plot.tre.path specifies the path to generate trelliscope files. The default is current working directory.

Value

The data frame including activity, filtering stats, optional covariates, and trelliscope panels. (No data frame will be returned if plot.tre is TRUE.)

See Also

form

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
data(lis3)
data(var3)

#### individual mean activity plot: return a dataset with trelliscope panels
tre.ind <- tre(lis3,varlis=var3)
tre.ind$activity_ind <- tre.ind$activity_all <- NULL
trelliscopejs::trelliscope(tre.ind,name = "Individual Mean Activity Plot", 
                           nrow = 2, ncol = 2,path=tempdir())

#### day activity plot: directly generating trelliscope visualization
tre(lis3,plot.ind=FALSE,plot.ori=FALSE,plot.tre=TRUE,plot.tre.path=tempdir())

## End(Not run) 

xinyue-L/PML documentation built on Nov. 5, 2019, 12:29 p.m.