msboxes_R: msboxes_R

Description Usage Arguments Details Value Examples

View source: R/msboxes_R.R

Description

msboxes_R will create a json file containing parameters that will help MSMplus to automatically create the multi-state graph of each specific setting. However, the user has the option to design and create the multistate graph within the app as well.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
msboxes_R(
  data,
  id,
  yb,
  xb,
  boxwidth = 0.1,
  boxheight = 0.1,
  tstop,
  vartime = 1,
  tmat.,
  scale = 1,
  msm = FALSE,
  jsonpath = "~",
  name = "msboxes_R.json"
)

Arguments

data

Provide a dataset that is properly formatted for a multi-state analysis (eg. after msprep())

id

Provide an indentity variable

yb

Provide a vector of values for the y coordinates of the state boxes of the multi-state graph you want to create

xb

Provide a vector of values for the x coordinates of the state boxes of the multi-state graph you want to create

boxwidth

Provide the width of the state boxes of the multi-state graph you want to create (default 0.1)

boxheight

Provide the height of the state boxes of the multi-state graph you want to create (default 0.1)

tstop

Provide the Tstop variable of your dataset

vartime

A vector of time points at which the user wants to count the number of people in each state and the number of people that have made each transition

tmat.

The transition matrix (e.g transMat(x = list(c(2, 3),c(3), c() )) ).

scale

rescale time value

msm

In case the msm package is used, the function uses statetable.msm to calculate the frequencies.Default: FALSE

jsonpath

specify the path of the folder that the json file should be saved, Default: ""

name

Specify the name of the output json file, Default: 'msboxes_R.json'

Details

DETAILS

Value

Nstates, Ntransitions, xvalues, yvalues,boxwidth, boxheight, statenames, transnames, the start and end coordinates of the arrows that connect the state boxes, tmat, number of people in each state and the number of people that have made each transition

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
if(interactive()){
 #EXAMPLE
 
head(ebmt)

tmat <- transMat(x = list(c(2, 3),c(3), c() ), names = c("Transplant", "Platelet Recovery", "Relapse/Death" ) )

ebmt$age2=  recode(ebmt$age, ">40" =0, "20-40"=1,"<=20" =0 )
ebmt$age3=  recode(ebmt$age, ">40" =1, "20-40"=0,"<=20" =0 )

msebmt <- msprep(data = ebmt, trans = tmat, time = c(NA, "prtime", "rfstime"), status = c(NA, "prstat", "rfsstat"), keep=c("age2","age3"))


results=rpkg::msboxes_R(data=msebmt,id= msebmt$id, yb=c(0.3,0.5,0.75),
                              xb=c(0.5,0.2,0.7),boxwidth=0.1,boxheight=0.1,
                              tmat.= tmat, tstop=msebmt$Tstop,vartime=c(seq(0,1,by=1)),scale=365.25,
                              jsonpath="data", name="msboxes_EBMT_R.json" ) 

results
 }

## End(Not run)

nskourlis/rpkg documentation built on Dec. 22, 2021, 3:16 a.m.