LaTeX Representation of a Fitted Cox Model
latex.cph.RdCreates a file containing a LaTeX representation of the fitted model.
Usage
# S3 method for class 'cph'
latex(object, title,
file='',
append=FALSE, surv=TRUE, maxt=FALSE, which=NULL, varnames, columns=65,
inline=FALSE, before=if(inline)"" else "& &", after="", dec=3,
pretrans=TRUE, caption, digits=.Options$digits, size="",
...) # for cph fit
# S3 method for class 'lrm'
latex(object, title, file, append, which, varnames,
columns, inline, before, after, pretrans, caption,
digits=.Options$digits, size="", ...) # for lrm fit
# S3 method for class 'ols'
latex(object, title, file, append, which, varnames,
columns, inline, before, after, pretrans, caption,
digits=.Options$digits, size="", ...) # ols fit
# S3 method for class 'orm'
latex(object, title, file, append, which, varnames,
columns, inline, before, after, pretrans, caption,
digits=.Options$digits, size="", intercepts=nrp < 10, ...) # for orm fit
# S3 method for class 'pphsm'
latex(object, title, file, append, which=NULL, varnames,
columns, inline, before, after, pretrans, caption,
digits=.Options$digits, size="", ...) # pphsm fit
# S3 method for class 'psm'
latex(object, title, file, append, which=NULL, varnames,
columns, inline, before, after, pretrans, caption,
digits=.Options$digits, size="", ...) # psm fitArguments
- object
a fit object created by a
rmsfitting function.- title
ignored
- file,append
see
latex.default. Defaults to the console. When using html/markdown,fileis ignored.- surv
if
surv=TRUEwas specified tocph, the underlying survival probabilities fromobject$surv.summarywill be placed in a table unlesssurv=FALSE.- maxt
if the maximum follow-up time in the data (
object$maxtime) exceeds the last entry inobject$surv.summary, underlying survival estimates atobject$maxtimewill be added to the table ifmaxt=TRUE.- which,varnames,columns,inline,before,dec,pretrans
see
latex.default- after
if not an empty string, added to end of markup if
inline=TRUE- caption
a character string specifying a title for the equation to be centered and typeset in bold face. Default is no title.
- digits
see latexrms
- size
a LaTeX size to use, without the slash. Default is the prevailing size
- intercepts
for
ormfits. Default is to print intercepts if they are fewer than 10 in number. Set toTRUEorFALSEto force.- ...
ignored
Value
the name of the created file, with class c("latex","file"). This
object works with latex viewing and printing commands in Hmisc. If
file='' and options(prType=x is in effect, where x
is "html", "markdown" or "md", the result is run through
knitr::asis_output so that it will be rendered correctly no
matter which options are in effect in the chunk header.
Examples
if (FALSE) { # \dontrun{
require(survival)
units(ftime) <- "Day"
f <- cph(Surv(ftime, death) ~ rcs(age)+sex, surv=TRUE, time.inc=60)
w <- latex(f, file='f.tex') #Interprets fitted model and makes table of S0(t)
#for t=0,60,120,180,...
w #displays image, if viewer installed and file given above
latex(f) # send LaTeX code to the console for knitr
options(prType='html')
latex(f) # for use with knitr and R Markdown/Quarto using MathJax
} # }