[R] rms::latex.anova broken?
Frank Harrell
f.harrell at vanderbilt.edu
Wed Feb 8 19:57:17 CET 2017
In recent versions of rms on CRAN there was a non-downward compatible
change. To get latex output for summary, anova, and print on fit objects
you leave off file="" (because we're usually using knitr anyway) and use
options(prType='latex')
anova(f) # LaTeX output
You can use options(prType='html') to get special html output for RMarkdown
html reports and html notebooks.
There are small changes in Hmisc, e.g., leave off file="" for
latex(describe()).
Frank
------------------------------
Frank E Harrell Jr Professor and Chairman School of Medicine
Department of *Biostatistics* *Vanderbilt University*
On Wed, Feb 8, 2017 at 12:19 PM, Kevin E. Thorpe <kevin.thorpe at utoronto.ca>
wrote:
> Hi Frank.
>
> I sent this to r-help yesterday but have not received any answers from the
> list readers. I thought I'd send to you directly to see if you had any
> insight. Since I posted this yesterday I have updated my R installation to
> the latest patched version and still get the errors.
>
> I use latex(anova(...)) quite a bit so a fix or workaround would by most
> appreciated.
>
> All the best,
>
> Kevin
>
>
> -------- Forwarded Message --------
> Subject: rms::latex.anova broken?
> Date: Tue, 7 Feb 2017 14:23:46 -0500
> From: Kevin E. Thorpe <kevin.thorpe at utoronto.ca>
> To: R Help Mailing List <r-help at stat.math.ethz.ch>
>
> I am re-running some logistic regression analyses using lrm from the rms
> package but latex(anova(...)) appears to be broken on my system.
>
> Here is some anova() output followed by the latex() error for two models
> since the error changes. My sessionInfo() follows the other output. I have
> updated all my packages and re-installed Hmisc and rms plus dependencies.
> The only thing I haven't done yet is update R completely. Has anyone else
> encountered this and know how to solve it?
>
> anova(full)
>>
> Wald Statistics Response: id14
>
> Factor Chi-Square d.f. P
> birthweight_kilo 0.87 1 0.3517
> ageinmonth 4.12 1 0.0423
> zbmi 6.49 1 0.0108
> maxtbf 15.16 1 0.0001
> cowsmilk 6.54 1 0.0106
> Male 1.96 1 0.1611
> multivitamin 0.76 1 0.3819
> bottleuse 0.13 1 0.7194
> preterm 0.50 1 0.4811
> AGEINTRO_cowsmilk 0.06 1 0.8032
> AGEINTRO_complefood 0.61 1 0.4356
> TOTAL 30.49 11 0.0013
>
>> latex(anova(full),file="",table.env=FALSE,booktabs=TRUE)
>>
> Error in ifelse(sn %nin% c("d.f.", "MS", "Partial SS"), math(sn), sn) :
> could not find function "math"
>
>> anova(full.nl)
>>
> Wald Statistics Response: id14
>
> Factor Chi-Square d.f. P
> birthweight_kilo 3.68 2 0.1588
> Nonlinear 2.65 1 0.1037
> ageinmonth 16.25 2 0.0003
> Nonlinear 13.45 1 0.0002
> zbmi 4.07 2 0.1310
> Nonlinear 0.23 1 0.6323
> maxtbf 15.81 2 0.0004
> Nonlinear 2.57 1 0.1092
> cowsmilk 3.34 2 0.1880
> Nonlinear 1.16 1 0.2821
> Male 1.21 1 0.2711
> multivitamin 0.57 1 0.4494
> bottleuse 0.06 1 0.8100
> preterm 0.01 1 0.9418
> AGEINTRO_cowsmilk 3.65 2 0.1612
> Nonlinear 3.28 1 0.0700
> AGEINTRO_complefood 5.40 2 0.0671
> Nonlinear 4.00 1 0.0455
> TOTAL NONLINEAR 25.41 7 0.0006
> TOTAL 52.13 18 <.0001
>
>> latex(anova(full.nl),file="",table.env=FALSE,booktabs=TRUE)
>>
> Error in paste0(specs$lspace, specs$italics(substring(rowl, 2)), sep = "")
> :
> attempt to apply non-function
>
> sessionInfo()
>>
> R version 3.2.3 Patched (2016-01-31 r70055)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Slackware 14.2
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] rms_5.1-0 SparseM_1.74 Hmisc_4.0-2 ggplot2_2.2.1
> [5] Formula_1.2-1 survival_2.40-1 lattice_0.20-34 knitr_1.15.1
>
> loaded via a namespace (and not attached):
> [1] Rcpp_0.12.9 RColorBrewer_1.1-2 plyr_1.8.4
> [4] base64enc_0.1-3 tools_3.2.3 rpart_4.1-10
> [7] digest_0.6.12 polspline_1.1.12 tibble_1.2
> [10] gtable_0.2.0 htmlTable_1.9 checkmate_1.8.2
> [13] nlme_3.1-131 Matrix_1.2-8 mvtnorm_1.0-5
> [16] gridExtra_2.2.1 stringr_1.1.0 cluster_2.0.5
> [19] htmlwidgets_0.8 MatrixModels_0.4-1 grid_3.2.3
> [22] nnet_7.3-12 data.table_1.10.4 foreign_0.8-67
> [25] multcomp_1.4-6 TH.data_1.0-8 latticeExtra_0.6-28
> [28] magrittr_1.5 codetools_0.2-15 MASS_7.3-45
> [31] scales_0.4.1 backports_1.0.5 htmltools_0.3.5
> [34] splines_3.2.3 assertthat_0.1 colorspace_1.3-2
> [37] quantreg_5.29 sandwich_2.3-4 stringi_1.1.2
> [40] acepack_1.4.1 lazyeval_0.2.0 munsell_0.4.3
> [43] zoo_1.7-14
>
>
> --
> Kevin E. Thorpe
> Head of Biostatistics, Applied Health Research Centre (AHRC)
> Li Ka Shing Knowledge Institute of St. Michael's Hospital
> Assistant Professor, Dalla Lana School of Public Health
> University of Toronto
> email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list