Package 'nightingale'

Title: Visualize Data from Florence Nightingale's Mortality Analysis
Description: An exemplary R package for learning and trying out practices of research software engineering.
Authors: Jan Simson [aut, cre] (ORCID: <https://orcid.org/0000-0002-9406-7761>), Fritjof Jammers [aut]
Maintainer: Jan Simson <[email protected]>
License: MIT + file LICENSE
Version: 0.3.0
Built: 2026-05-25 06:30:14 UTC
Source: https://github.com/jansim/nightingale

Help Index


Mortality in the Crimean War

Description

A dataset containing mortality data from the Crimean War, famously visualized by Florence Nightingale. The data shows the number of deaths from various causes.

Usage

mortality

Format

A data frame with 24 rows and 5 variables:

date

Date of the record, in YYYY-MM-DD format.

disease

Annual mortality rate per 1000 from preventable or mitigable zymotic diseases.

wounds

Annual mortality rate per 1000 from wounds.

other

Annual mortality rate per 1000 from all other causes.

total

Total annual mortality rate per 1000 from all causes.

Source

Florence Nightingale's data, as compiled and processed. The raw data is from "Notes on Matters Affecting the Health, Efficiency, and Hospital Administration of the British Army" by Florence Nightingale, 1858. https://wellcomecollection.org/works/jxwtskzc/items?canvas=9 Extracted by Livnah from Datawrapper. https://www.datawrapper.de/blog/recreating-nightingale-rose-chart


Create a Bar Plot of Mortality Data

Description

This function creates a bar plot visualization of mortality data from the Crimean War, showing deaths per 1000 soldiers per year. The plot includes a vertical line marking when Nightingale's sanitary improvements were implemented in February/March 1855.

Usage

show_barplot(
  mortality_data = mortality,
  metrics = c("disease", "other", "wounds"),
  highlight_intervention = TRUE
)

Arguments

mortality_data

A data frame containing mortality data with columns for date and various causes of death. Defaults to the 'mortality' dataset.

metrics

A character vector specifying the metrics to include in the visualization. Defaults to c("disease", "other", "wounds").

highlight_intervention

Logical. Whether to include a vertical line marking Nightingale's sanitary improvements. Defaults to TRUE.

Value

A ggplot2 object representing the bar plot of mortality data.

Examples

# Basic bar plot without total column
show_barplot()

# Bar plot including total mortality
show_barplot(metrics = c("disease", "other", "wounds", "total"))

Launch Shiny Dashboard for Mortality Data

Description

This function launches a Shiny dashboard that displays the bar plot of mortality data. Users can select the causes of death to display and toggle the vertical line marking Nightingale's improvements.

Usage

show_shiny_app(mortality_data = mortality)

Arguments

mortality_data

A data frame containing mortality data with columns for date and various causes of death. Defaults to the 'mortality' dataset.

Details

The dashboard provides an interactive interface for visualizing mortality data from the Crimean War. Users can: - Select specific causes of death to display in the bar plot. - Toggle the visibility of a vertical line that marks the implementation of Nightingale's sanitary improvements in February 1855.

The bar plot is generated using the 'show_barplot()' function, and the data is dynamically filtered based on user input.

See Also

show_barplot for the function that generates the bar plot.

Examples

if (interactive()) {
  show_shiny_app()
}