The htmlTable, forestplot, Gmisc, and Greg packages contain useful functions for graphics, tables etc that I’ve created/adapted for my own research. As of 2016-03-29 they’re all on CRAN.
htmlTable() has moved as of 1.0 to a separate package in December 2014. The Gmisc will depend on this new package and the change should have minimal impact on user experience. There are plenty of new features and a few API-changes that may be good to be aware of (although the old API will work for 1-2 years only with warnings):
- rowname -> rnames
- headings -> header
- halign -> align.header
- cgroup.just -> align.cgroup
- rgroupCSSstyle -> css.rgroup
- rgroupCSSseparator -> css.rgroup.sep
- tspannerCSSstyle -> css.tspanner
- tspannerCSSseparator -> css.tspanner.sep
- rgroup.padding -> padding.rgroup
- rowlabel.pos -> pos.rowlabel
- caption.loc -> pos.caption
- altcol -> col.rgroup
- tableCSSclass -> css.table.class
The htmlTable-package is all about generating pretty tables, you can find some examples from my blog-posts below:
- Introducing the htmlTable-package
- Tables from R into Word
- Fast-track publishing using knitr: table mania
If you are interested in adding conditional formatting the condformat allows you to add this, developed by Sergio Oller. Works very similar to Excel’s conditional formatting and has borrowed from the awesome ggplot2 syntax.
forestplot() has moved as of 1.0 to a separate package in December 2014. The Gmisc will have a deprecated call but the link between the package will be removed in the future (2017?). There are plenty of new features and a few API-changes that may be good to be aware of (although the old API will work for 1-2 years only with warnings):
- legend.* -> legend_args and takes input from
- confintNormalFn -> fn.ci_norm
- confintSummaryFn -> fn.ci_sum
- legendMarkerFn -> fn.legend
- main -> Title
The package also contains a vignette that you may want to look into:
The Gmisc package 1.0 was releast in December 2014 on CRAN. Apart from minor API-changes there is the new
mergeDesc() that I recommend looking into. Compiling a descriptive table has never been easier.
The Greg package
The package was finally released on CRAN 2016-03-29. It contains popular functions such as
printCrudeAndAdjusted and also a bunch of other stuff that I use both for describing and manipulating models. See the Readme for details.
Development versions on GitHub
As CRAN limits the update frequency to 1-2 months you can download the most recent package from GitHub. You can download them using the
devtools package and downloading the develop branch:
# If you haven't installed devtools before, # now is the time by uncommenting next line: # install.packages("devtools") # Install the htmlTable package using: devtools::install_github("gforge/htmlTable", ref="develop") # Install the forestplot package using: devtools::install_github("gforge/forestplot", ref="develop") # Install the Gmisc package using: devtools::install_github("gforge/Gmisc", ref="develop") # Install the Greg package using: devtools::install_github("gforge/Greg", ref="develop")
The comorbidities.icd10 package (not yet on CRAN)
As I’ve worked a lot with calculating comorbidities from ICD codes I’ve adapted the previous comorbidities package by Paul Gerrard. It has been thoroughly tested and is reasonably fast but I haven’t yet released it on CRAN. You can find it on GitHub.
Please help out
Maintaining and updating these packages takes a lot of time so any help is always appreciated. Use GitHub for filing issues, forking and doing pull requests. By filing issues everyone benefits from your questions.
Some of the functionality that I’ve blogged about:
- getDescriptionsStatsBy – for generating a table 1 this is a very useful function that makes this much easier.
- transitionPlot – for generating a transition plot
- bezierArrowSmpl/bezierArrowSmplGradient – nicer alternatives to the default bezier arrow.
- printCrudeAndAdjusted – a useful function for generating a table with a models crude and adjusted estimates.
- plotHR – this is based upon r-forge Reinhard Seifert’s plotHR function]. The function allows multiple models to be plotted on top of eachother, when used together with transparency (the alpha channel of the rgb) it is very convenient for comparing different subgroups, time-spans or adjusted/unadjusted regressions.
I hope you find the packages as useful as I do. And in case you were wondering – Yes, the Gmisc name was inspired by Frank Harrell’s Hmisc-package.