This is an R Markdown html document using the template that is here. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
require(rms) knitrSet(lang='markdown')
The following (r hidingTOC(buttonLabel="Outline")
) uses the Hmisc hidingTOC
function to define HTML styles related to a floating table of contents that can be minimized or be collapsed to major outline levels. For more details see this.
r hidingTOC(buttonLabel="Outline")
getHdata(titanic3) # Get the dataset from the VU DataSets page mu <- markupSpecs$html # markupSpecs is in Hmisc subtext <- mu$subtext code <- mu$code
html(contents(titanic3), maxlevels=10, levelType='table')
r subtext('for the', code('titanic3'), 'dataset')
# Set graphics type so that Hmisc and rms packages use plotly # Chunk header height=150 is in pixels # For certain print methods set to use html options(grType='plotly', prType='html') s <- summaryM(age + pclass ~ sex, data=titanic3) html(s) plot(s) d <- describe(titanic3) plot(d)
The following doesn't work because it overlays two different legends
# Try combining two plots into one p <- plot(d) plotly::subplot(p[[1]], p[[2]], nrows=2, heights=c(.3, .7), which_layout=1)
dd <- datadist(titanic3); options(datadist='dd') f <- lrm(survived ~ rcs(sqrt(age),5) * sex, data=titanic3) print(f) latex(f) a <- anova(f) print(a) plot(a)
s <- summary(f, age=c(2, 21)) plot(s, log=TRUE) print(s, dec=2)
ggplot(Predict(f, age, sex), height=500, width=650) # uses ggplotly() plotp(Predict(f, age, sex)) # uses plotly directly plot(nomogram(f, fun=plogis, funlabel='Prob(survive)'))
r mu$code('pbc')
DatasetHover over the curves to see particular probability estimates and numbers at risk. Click on legend components to show/hide components.
getHdata(pbc) pbc <- upData(pbc, fu.yrs = fu.days / 365.25, units = c(fu.yrs = 'year')) f <- npsurv(Surv(fu.yrs, status) ~ spiders, data=pbc) survplotp(f, time.inc=1, times=c(5, 10), fun=function(y) 1 - y)
r mu$session()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.