R Dataset / Package HistData / Nightingale

How To Create a Barplot

Webform

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Help

Description

Describes how to create a bar plot based on count data. For an example of count data, see the email50 curated data set which was taken from the Open Intro AHSS textbook (not affiliated). An example of count data in this dataset would be the spam column.

Usage

Select one (1) column to create its barplot and then click 'Submit'. If you do not choose count data, you may get unexpected results.

See Also

Students may also be interested in creating barplots for contingency tables.

For a stacked side-by-side barplot, see the other barplot app.

How To Create a Stacked Barplot

Webform

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Help

Usage

Select 1 (one) column from a contingency table like the Gender and Politics or VADeaths curated datasets.

If you do not choose a contingency table, you may get unexpected results. You can import a dataset if you are logged-in.

Details

Shows the student how to create a single stacked bar plot based on a column in a contingency table.

See Also

For a basic barplot (single column) based on count data see the count data barplot app.

For a stacked side-by-side barplot see the other stacked barplot app for categorical data.

How To Create a Pie Chart

Webform

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Help

Usage

Select 1 (one) column from a contingency table. If you don't have your own dataset, you can choose the Gender and Politics or VADeaths curated datasets. If a contingency table is not chosen, you may get unexpected results.

A contingency table has columns like a regular dataset, but the first row contains row names that categorize and "split-up" the dataset. An example of a contingency table would be something like this:

LIBERAL CONSERVATIVE
F 762 468
M 484 477

This contingency table is take from the Gender and Politics dataset. You can get a preview by selecting the dataset from the Curated Data dropdown above.

Details

This app shows the student how to create a pie chart from a contingency table by hand using a Quadstat dataset.

A pie chart shows proportions of a sample or population. Each piece of a pie chart corresponds to some subset of the sample or population. In this case, we will use the contingency table rows to subset the sample.

See Also

Students may also want to view the app for creating a pie chart from count data.

How To Compute the Mean

Webform

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Help

Usage

Click "Submit" after selecting one column to see how to compute the arithmetic mean (average) of data (vectors).

Description

If all the values of a sample were plotted on a number line, the average would be the point in the middle that would balance the two sides.

The average is greatly influenced by outliers, meaning extreme points can pull the average to the left or right.

If we are referring to the average of population (all observations), the symbol for the average (arithmetic mean) is $\mu$.

If we are referring to the average of a sample (a subset of the population), the symbol for the average (arithmetic mean) is $\bar{x}$.

Computing the average

Suppose we have a sample consisting of $x_1, x_2, x_3,...,x_n$. This means we have $n$ observations. Then,

$$\bar{x}=\frac{x_1, x_2, x_3,...,x_n}{n}.$$

The formula tells us that we need to add all the observations and then divide by the number of observations to compute the mean.

Example 1

Compute the mean of $A = \{1,2,3\}$.

$$\bar{x} = \frac{1+2+3}{3} = 2.$$

How To Create a Plot

Webform

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Help

Usage

Select two columns which are to be used in the scatterplot. The first column clicked will be the independent variable (X-axis).

Description

This web application describes how to create a scatterplot of two dataset variables plotted on the xy-axes.

How to Compute the Median

Webform

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Help

Median Value

Description

Compute the sample median.

Usage

median(x, na.rm = FALSE, ...)

Arguments

x

an object for which a method has been defined, or a numeric vector containing the values whose median is to be computed.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

...

potentially further arguments for methods; not used in the default method.

Value

The default method returns a length-one object of the same type as x, except when x is logical or integer of even length, when the result will be double.

If there are no values or if na.rm = FALSE and there are NA values the result is NA of the same type as x (or more generally the result of x[FALSE][NA]).

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Boxplot

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Correlation Coefficient

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Cumulative Frequency Histogram

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Dotplot

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Hollow Histogram

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Mean

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Pie Chart

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Plot

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Regression

Please see the full application for additional options and documentation.

Stem and Leaf Plots

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Summary

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.

Visual Summaries

Please see the full application for additional options and documentation.

The Drupal File ID of the selected dataset. The user may load another using the search bar on the operation's page.
Attachment Size
dataset-95302.csv 1.3 KB
Dataset License
GNU General Public License v2.0
Documentation

Florence Nightingale's data on deaths from various causes in the Crimean War

Description

In the history of data visualization, Florence Nightingale is best remembered for her role as a social activist and her view that statistical data, presented in charts and diagrams, could be used as powerful arguments for medical reform.

After witnessing deplorable sanitary conditions in the Crimea, she wrote several influential texts (Nightingale, 1858, 1859), including polar-area graphs (sometimes called "Coxcombs" or rose diagrams), showing the number of deaths in the Crimean from battle compared to disease or preventable causes that could be reduced by better battlefield nursing care.

Her Diagram of the Causes of Mortality in the Army in the East showed that most of the British soldiers who died during the Crimean War died of sickness rather than of wounds or other causes. It also showed that the death rate was higher in the first year of the war, before a Sanitary Commissioners arrived in March 1855 to improve hygiene in the camps and hospitals.

Usage

data(Nightingale)

Format

A data frame with 24 observations on the following 10 variables.

Date

a Date, composed as as.Date(paste(Year, Month, 1, sep='-'), "%Y-%b-%d")

Month

Month of the Crimean War, an ordered factor

Year

Year of the Crimean War

Army

Estimated average monthly strength of the British army

Disease

Number of deaths from preventable or mitagable zymotic diseases

Wounds

Number of deaths directly from battle wounds

Other

Number of deaths from other causes

Disease.rate

Annual rate of deaths from preventable or mitagable zymotic diseases, per 1000

Wounds.rate

Annual rate of deaths directly from battle wounds, per 1000

Other.rate

Annual rate of deaths from other causes, per 1000

Details

For a given cause of death, D, annual rates per 1000 are calculated as 12 * 1000 * D / Army, rounded to 1 decimal.

The two panels of Nightingale's Coxcomb correspond to dates before and after March 1855

Source

The data were obtained from:

Pearson, M. and Short, I. (2007). Understanding Uncertainty: Mathematics of the Coxcomb. http://understandinguncertainty.org/node/214.

References

Nightingale, F. (1858) Notes on Matters Affecting the Health, Efficiency, and Hospital Administration of the British Army Harrison and Sons, 1858

Nightingale, F. (1859) A Contribution to the Sanitary History of the British Army during the Late War with Russia London: John W. Parker and Son.

Small, H. (1998) Florence Nightingale's statistical diagrams http://www.florence-nightingale-avenging-angel.co.uk/GraphicsPaper/Graphics.htm

Pearson, M. and Short, I. (2008) Nightingale's Rose (flash animation). http://understandinguncertainty.org/files/animations/Nightingale11/Nightingale1.html

Examples

data(Nightingale)# For some graphs, it is more convenient to reshape death rates to long format
#  keep only Date and death rates
require(reshape)
Night<- Nightingale[,c(1,8:10)]
melted <- melt(Night, "Date")
names(melted) <- c("Date", "Cause", "Deaths")
melted$Cause <- sub("\\.rate", "", melted$Cause)
melted$Regime <- ordered( rep(c(rep('Before', 12), rep('After', 12)), 3), 
                          levels=c('Before', 'After'))
Night <- melted# subsets, to facilitate separate plotting
Night1 <- subset(Night, Date < as.Date("1855-04-01"))
Night2 <- subset(Night, Date >= as.Date("1855-04-01"))# sort according to Deaths in decreasing order, so counts are not obscured [thx: Monique Graf]
Night1 <- Night1[order(Night1$Deaths, decreasing=TRUE),]
Night2 <- Night2[order(Night2$Deaths, decreasing=TRUE),]# merge the two sorted files
Night <- rbind(Night1, Night2)
require(ggplot2)
# Before plot
cxc1 <- ggplot(Night1, aes(x = factor(Date), y=Deaths, fill = Cause)) +
		# do it as a stacked bar chart first
   geom_bar(width = 1, position="identity", stat="identity", color="black") +
		# set scale so area ~ Deaths	
   scale_y_sqrt() 
		# A coxcomb plot = bar chart + polar coordinates
cxc1 + coord_polar(start=3*pi/2) + 
	ggtitle("Causes of Mortality in the Army in the East") + 
	xlab("")# After plot
cxc2 <- ggplot(Night2, aes(x = factor(Date), y=Deaths, fill = Cause)) +
   geom_bar(width = 1, position="identity", stat="identity", color="black") +
   scale_y_sqrt()
cxc2 + coord_polar(start=3*pi/2) +
	ggtitle("Causes of Mortality in the Army in the East") + 
	xlab("")## Not run: 
# do both together, with faceting
cxc <- ggplot(Night, aes(x = factor(Date), y=Deaths, fill = Cause)) +
 geom_bar(width = 1, position="identity", stat="identity", color="black") + 
 scale_y_sqrt() +
 facet_grid(. ~ Regime, scales="free", labeller=label_both)
cxc + coord_polar(start=3*pi/2) +
	ggtitle("Causes of Mortality in the Army in the East") + 
	xlab("")## End(Not run)## What if she had made a set of line graphs?# these plots are best viewed with width ~ 2 * height 
colors <- c("blue", "red", "black")
with(Nightingale, {
	plot(Date, Disease.rate, type="n", cex.lab=1.25, 
		ylab="Annual Death Rate", xlab="Date", xaxt="n",
		main="Causes of Mortality of the British Army in the East");
	# background, to separate before, after
	rect(as.Date("1854/4/1"), -10, as.Date("1855/3/1"), 
		1.02*max(Disease.rate), col=gray(.90), border="transparent");
	text( as.Date("1854/4/1"), .98*max(Disease.rate), "Before Sanitary\nCommission", pos=4);
	text( as.Date("1855/4/1"), .98*max(Disease.rate), "After Sanitary\nCommission", pos=4);
	# plot the data
	points(Date, Disease.rate, type="b", col=colors[1], lwd=3);
	points(Date, Wounds.rate, type="b", col=colors[2], lwd=2);
	points(Date, Other.rate, type="b", col=colors[3], lwd=2)
	}
)
# add custom Date axis and legend
axis.Date(1, at=seq(as.Date("1854/4/1"), as.Date("1856/3/1"), "3 months"), format="%b %Y")
legend(as.Date("1855/10/20"), 700, c("Preventable disease", "Wounds and injuries", "Other"),
	col=colors, fill=colors, title="Cause", cex=1.25)# Alternatively, show each cause of death as percent of total
Nightingale <- within(Nightingale, {
	Total <- Disease + Wounds + Other
	Disease.pct <- 100*Disease/Total
	Wounds.pct <- 100*Wounds/Total
	Other.pct <- 100*Other/Total
	})colors <- c("blue", "red", "black")
with(Nightingale, {
	plot(Date, Disease.pct, type="n",  ylim=c(0,100), cex.lab=1.25,
		ylab="Percent deaths", xlab="Date", xaxt="n",
		main="Percentage of Deaths by Cause");
	# background, to separate before, after
	rect(as.Date("1854/4/1"), -10, as.Date("1855/3/1"), 
		1.02*max(Disease.rate), col=gray(.90), border="transparent");
	text( as.Date("1854/4/1"), .98*max(Disease.pct), "Before Sanitary\nCommission", pos=4);
	text( as.Date("1855/4/1"), .98*max(Disease.pct), "After Sanitary\nCommission", pos=4);
	# plot the data
	points(Date, Disease.pct, type="b", col=colors[1], lwd=3);
	points(Date, Wounds.pct, type="b", col=colors[2], lwd=2);
	points(Date, Other.pct, type="b", col=colors[3], lwd=2)
	}
)
# add custom Date axis and legend
axis.Date(1, at=seq(as.Date("1854/4/1"), as.Date("1856/3/1"), "3 months"), format="%b %Y")
legend(as.Date("1854/8/20"), 60, c("Preventable disease", "Wounds and injuries", "Other"),
	col=colors, fill=colors, title="Cause", cex=1.25)
--

Dataset imported from https://www.r-project.org.

Documentation License
GNU General Public License v2.0

From Around the Site...

Title Authored on Content type
R Dataset / Package wooldridge / hprice3 March 9, 2018 - 1:06 PM Dataset
R Dataset / Package KMsurv / aids March 9, 2018 - 1:06 PM Dataset
R Dataset / Package robustbase / wagnerGrowth March 9, 2018 - 1:06 PM Dataset
R Dataset / Package car / Ericksen March 9, 2018 - 1:06 PM Dataset
Bilgin3 May 26, 2019 - 5:31 PM Dataset