This vignette is a description of the distribution characteristics of patients' Age bands for the CLAHRC NWL Heart Failure Care Bundle project at North West London Hospitals.
The original raw data set from North West London Hospitals clahrcnwlf::admission_data
was extracted and cleaned for analysis by Dr. T Woodcock using clahrcnwlhf::clean_and_save
. The data covers discharge periods 1st January 2012 to 31st October 2016.
This analysis is restricted to only emergency admissions data clahrcnwlhf::emergency_adms
(i.e. data for those episodes for which admission_data_clean$AdmissionType = "Emergency"
).
emergency_adms <- clahrcnwlhf::emergency_adms
AGE DISTRIBUTION FREQUENCY
Let us first restrict attention to only the first episode of each spell.
emergency_spells <- emergency_adms[ which(emergency_adms[,"EpisodeNumber"] == 1),]
period.date
First lets plot a plot of age-dist Age Band
frequency using emergency_spells data
. Age Band in the first ggplot is split by period.date
: period A
(discharges before the CLAHRC NWL Heart Failure Care Bundle project) and period B
(discharges after the CLAHRC NWL Heart Failure Care Bundle project)
#test <- clahrcnwlhf::plot_age_dist(emergency_adms) #dataframe restricted to only rows where 'new.spell' = TRUE ggplot2::ggplot(emergency_adms, ggplot2::aes(x=AgeBand))+ggplot2::geom_bar(width= 0.7)+ggplot2::facet_wrap( ~ period.date)+ggplot2::ggtitle("Distribution by Age Band Across Period Dates A and B")+ggplot2::coord_flip()+ggplot2::ylab("Frequency")+ggplot2::xlab("Age Band")
Second lets plot out
ggplot2::ggplot(emergency_adms, ggplot2::aes(x=AgeBand))+ggplot2::geom_bar(width= 0.7)+ggplot2::ggtitle("Distribution by Age Bands")+ggplot2::coord_flip()+ggplot2::ylab("Frequency")+ggplot2::xlab("Age Band")
ageband_perioddate <- clahrcnwlhf::plot_dist_table(emergency_adms) #age band distribution for both periods + sum of both addmargins(table(emergency_adms$AgeBand, emergency_adms$period.date),2) ageband_perioddate #this is what I run in the command line
The html_vignette
template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows:
output: rmarkdown::html_vignette: css: mystyles.css
The figure sizes have been customised so that you can easily put two images side-by-side.
plot(1:10) plot(10:1)
You can enable figure captions by fig_caption: yes
in YAML:
output: rmarkdown::html_vignette: fig_caption: yes
Then you can use the chunk option fig.cap = "Your figure caption."
in knitr.
You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using knitr::kable()
.
knitr::kable(head(mtcars, 10))
Also a quote using >
:
"He who gives up [code] safety for [code] speed deserves neither." (via)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.