jointmetaplotall: Arrange study plots into a grid

Description Usage Arguments Value See Also Examples

View source: R/jointmetaplotall.R

Description

This function is designed to take the output from jointmetaplot and output the study plots of each type arranged into a grid.

Usage

1
2
jointmetaplotall(plotlist, ncol, nrow = NULL, top = NULL,
  type = c("Longitudinal", "Event", "Both"))

Arguments

plotlist

the output from running the jointmetaplot function.

ncol

the number of columns of the grid to arrange the plots in. This must be supplied to the function

nrow

the number of rows of the grid to arrange the plot in. This is an optional parameter, which if not supplied is calculated in the function based on the number of supplied plots and the specified value of ncol.

top

a character string to act as the title for the plots

type

option to select what type of plots should be returned. If just the grid of the longitudinal trajectories are required then type = 'Longitudinal'. Else if just the grid of the survival probabilities graphs are required then type = 'Survival'. Finally if grids of both survival and longitudinal plots are required then this should be set to type = 'Both'. If both, then the same title as supplied to top will be used, similarly for ncol and nrow.

Value

An object of class 'jointplotsall' is returned. If in the function call type = 'Longitudinal' or type = 'Both' then the element in the returned object names 'longall' is the arranged grid of longitudinal trajectory plots from each study in the dataset. If type = 'Survival' or type = 'Both' then the element in the returned object labelled 'eventsall' is the arranged grid of the survival probability plots from each study in the dataset. The arranged grids can either be printed by name, or by extracting them as you would an element from a list.

See Also

jointmetaplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    ## Not run: 
    #change data to jointdata format
    jointdat<-tojointdata(longitudinal = simdat$longitudinal,
                          survival = simdat$survival, id = 'id',
                          longoutcome = 'Y', timevarying = c('time','ltime'),
                          survtime = 'survtime', cens = 'cens',
                          time = 'time')

    #ensure variables are correctly formatted
    jointdat$baseline$study <- as.factor(jointdat$baseline$study)
    jointdat$baseline$treat <- as.factor(jointdat$baseline$treat)

    #produce plots
    #note that inclusion of a smoother sometime results in error messages
    #see ggplot2 for error message interpretation
    sepplots<-jointmetaplot(dataset = jointdat, study = 'study',
                        longoutcome = 'Y', longtime = 'time',
                        survtime = 'survtime', cens = 'cens', id = 'id',
                        smoother = TRUE, studynames = c('Study 1', 'Study 2',
                        'Study 3', 'Study 4', 'Study 5'), type = 'Both')

    allplot2<-jointmetaplotall(plotlist = sepplots, ncol =2,
             top = 'All studies', type = 'Both')
   
## End(Not run)

mesudell/joineRmeta documentation built on Jan. 24, 2020, 6:06 p.m.