boxesLx {cohorttools}R Documentation

Boxes plot summarizing Lexis object

Description

Creates boxes graph describing Lexis

Usage

boxesLx(
  x,
  layout = "circo",
  prop.penwidth = FALSE,
  scale.Y = 1,
  rankdir = "TB",
  node.attr = "shape=box",
  edge.attr = "minlen=1",
  show.loop = FALSE,
  show.persons = FALSE,
  fontsizeN = 14,
  fontsizeL = 8,
  show.gr = TRUE
)

Arguments

x

Lexis object

layout

Graphviz layout "circo", "dot", "twopi" or, "neato". It determines general layout of graph.

prop.penwidth

use line width relative to incidence. If TRUE linewidths of showing transition rates beween states are relative to log of rate.

scale.Y

scale for incidence. Scale factor rates, default is 1.

rankdir

for graph, default is TB. NOTE! this works best with layout "dot"

node.attr

general node attributers. Attributes like shape, color, fillcolor, etc. for nodes. Consult Graphviz documentation for details https://www.graphviz.org/doc/info/attrs.html.

edge.attr

general edge (line) attributers. Attributes like color, arrowhead, fontcolor etc. for edges. Consult Graphviz documentation for details https://www.graphviz.org/doc/info/attrs.html

show.loop

, should loop (staying in same state be shown), default FALSE

show.persons

, should number of persons be shown (entry->exit), default FALSE

fontsizeN

font size for nodes

fontsizeL

font size for edges

show.gr

should graph be shown. If TRUE, function DiagrammeR::grViz is used to show graph.

Value

Character vector containing Graphviz script. This may used to create graph by DiagrammeR::grViz function.

Author(s)

Jari Haukka jari.haukka@helsinki.fi

See Also

grViz

Examples

library(DiagrammeR)
library(survival)
library(Epi)
library(mstate)
data(ebmt3)
bmt <- Lexis(exit = list(tft = rfstime/365.25),
             exit.status = factor(rfsstat, labels = c("Tx", "RD")),
                          data = ebmt3)
bmtr <- cutLexis(bmt, cut = bmt$prtime/365.25, precursor.states = "Tx",
                                           new.state = "PR")

summary(bmtr)
kk<-boxesLx(bmtr)
## Not run: 
# Graph to file
gv2image(kk, file="k1", type="pdf")

## End(Not run)
boxesLx(bmtr,layout="dot",rankdir = "LR",show.loop = FALSE,show.persons = TRUE)
boxesLx(bmtr,node.attr='shape=hexagon color=navy style=filled fillcolor=lightblue',
edge.attr = ' color=steelblue arrowhead=vee fontcolor="#8801d7" ',
layout="circo",prop.penwidth=TRUE)

[Package cohorttools version 0.1.4 Index]