# R Dataset / Package HistData / Snow.deaths

Webform
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.

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

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

Category

Webform
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.

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.

Category

Webform
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.

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

Category

Webform
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.$$
Category

Webform
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.

Category

Webform
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.

Category

## Boxplot

Submitted by pmagunia on April 22, 2018 - 3:07 PM

## Correlation Coefficient

Submitted by pmagunia on April 22, 2018 - 3:08 PM

## Cumulative Frequency Histogram

Submitted by pmagunia on April 22, 2018 - 3:09 PM

## Dotplot

Submitted by pmagunia on April 22, 2018 - 3:10 PM

## Hollow Histogram

Submitted by pmagunia on April 22, 2018 - 3:10 PM

## Mean

Submitted by pmagunia on April 22, 2018 - 3:11 PM

## Pie Chart

Submitted by pmagunia on April 22, 2018 - 3:11 PM

## Plot

Submitted by pmagunia on April 22, 2018 - 3:07 PM

## Regression

Submitted by pmagunia on April 22, 2018 - 3:12 PM

## Stem and Leaf Plots

Submitted by pmagunia on April 22, 2018 - 3:12 PM

## Summary

Submitted by pmagunia on April 22, 2018 - 2:51 PM

## Visual Summaries

Submitted by pmagunia on April 22, 2018 - 3:13 PM
Submitted by pmagunia on March 9, 2018 - 1:06 PM
Attachment Size
12.18 KB
Documentation

## John Snow's Map and Data on the 1854 London Cholera Outbreak

### Description

The Snow data consists of the relevant 1854 London streets, the location of 578 deaths from cholera, and the position of 13 water pumps (wells) that can be used to re-create John Snow's map showing deaths from cholera in the area surrounding Broad Street, London in the 1854 outbreak. Another data frame provides boundaries of a tesselation of the map into Thiessen (Voronoi) regions which include all cholera deaths nearer to a given pump than to any other.

The apocryphal story of the significance of Snow's map is that, by closing the Broad Street pump (by removing its handle), Dr. Snow stopped the epidemic, and demonstrated that cholera is a water borne disease. The method of contagion of cholera was not previously understood. Snow's map is the most famous and classical example in the field of medical cartography, even if it didn't happen exactly this way. (the apocryphal part is that the epidemic ended when the pump handle was removed.) At any rate, the map, together with various statistical annotations, is compelling because it points to the Broad Street pump as the source of the outbreak.

### Usage

	data(Snow.deaths)
data(Snow.pumps)
data(Snow.streets)
data(Snow.polygons)
data(Snow.dates)


### Format

Snow.deaths: A data frame with 578 observations on the following 3 variables, giving the address of a person who died from cholera. When many points are associated with a single street address, they are "stacked" in a line away from the street so that they are more easily visualized. This is how they are displayed on John Snow's original map. The dates of the deaths are not individually recorded in this data set.

case

Sequential case number, in some arbitrary, randomized order

x

x coordinate

y

y coordinate

Snow.pumps: A data frame with 13 observations on the following 4 variables, giving the locations of water pumps within the boundaries of the map.

pump

pump number

label

pump label: Briddle St Broad St ... Warwick

x

x coordinate

y

y coordinate

Snow.streets: A data frame with 1241 observations on the following 4 variables, giving coordinates used to draw the 528 street segment lines within the boundaries of the map. The map is created by drawing lines connecting the n points in each street segment.

street

street segment number: 1:528

n

number of points in this street line segment

x

x coordinate

y

y coordinate

Snow.polygons: A list of 13 data frames, giving the vertices of Thiessen (Voronoi) polygons containing each pump. Their boundaries define the area that is closest to each pump relative to all other pumps. They are mathematically defined by the perpendicular bisectors of the lines between all pumps. Each data frame contains:

x

x coordinate

y

y coordinate

Snow.deaths2: An alternative version of Snow.deaths correcting some possible duplicate and missing cases, as described in vignette("Snow_deaths-duplicates").

Snow.dates: A data frame of 44 observations and 3 variables from Table 1 of Snow (1855), giving the number of fatal attacks and number of deaths by date from Aug. 19 – Sept. 30, 1854. There are a total of 616 deaths represented in both columns attacks and deaths; of these, the date of the attack is unknown for 45 cases.

### Details

The scale of the source map is approx. 1:2000. The (x, y) coordinate units are 100 meters, with an arbitrary origin.

Of the data in the Snow.dates table, Snow says, “The deaths in the above table are compiled from the sources mentioned above in describing the map; but some deaths which were omitted from the map on account of the number of the house not being known, are included in the table.”

One limitation of these data sets is the lack of exact street addresses. Another is the lack of any data that would serve as a population denominator to allow for a comparison of mortality rates in the Broad Street pump area as opposed to others. See Koch (2000), Koch (2004), Koch \& Denike (2009) and Tufte (1999), p. 27-37, for further discussion.

### Source

Tobler, W. (1994). Snow's Cholera Map, http://www.ncgia.ucsb.edu/pubs/snow/snow.html; data files were obtained from http://ncgia.ucsb.edu/Publications/Software/cholera/, but these sites seem to be down.

The data in these files were first digitized in 1992 by Rusty Dodson of the NCGIA, Santa Barbara, from the map included in the book by John Snow: "Snow on Cholera...", London, Oxford University Press, 1936.

### References

Koch, T. (2000). Cartographies of Disease: Maps, Mapping, and Medicine. ESRI Press. ISBN: 9781589481206.

Koch, T. (2004). The Map as Intent: Variations on the Theme of John Snow Cartographica, 39 (4), 1-14.

Koch, T. and Denike, K. (2009). Crediting his critics' concerns: Remaking John Snow's map of Broad Street cholera, 1854. Social Science \& Medicine 69, 1246-1251.

Snow, J. (1885). On the Mode of Communication of Cholera. London: John Churchill. http://www.ph.ucla.edu/epi/snow/snowbook.html.

Tufte, E. (1997). Visual Explanations. Cheshire, CT: Graphics Press.

SnowMap

### Examples

data(Snow.deaths)
data(Snow.pumps)
data(Snow.streets)
data(Snow.polygons)
data(Snow.deaths)## Plot deaths over time
require(lubridate)
clr <- ifelse(Snow.dates$date < mdy("09/08/1854"), "red", "darkgreen") plot(deaths ~ date, data=Snow.dates, type="h", lwd=2, col=clr) points(deaths ~ date, data=Snow.dates, cex=0.5, pch=16, col=clr) text( mdy("09/08/1854"), 40, "Pump handle\nremoved Sept. 8", pos=4) ## draw Snow's map and dataSnowMap()# add polygons SnowMap(polygons=TRUE, main="Snow's Cholera Map with Pump Polygons")# zoom in a bit, and show density estimate SnowMap(xlim=c(7.5,16.5), ylim=c(7,16), polygons=TRUE, density=TRUE, main="Snow's Cholera Map, Annotated") ## re-do this the sp way... [thx: Stephane Dray]library(sp)# streets slist <- split(Snow.streets[,c("x","y")],as.factor(Snow.streets[,"street"])) Ll1 <- lapply(slist,Line) Lsl1 <- Lines(Ll1,"Street") Snow.streets.sp <- SpatialLines(list(Lsl1)) plot(Snow.streets.sp, col="gray") title(main="Snow's Cholera Map of London (sp)")# deaths Snow.deaths.sp = SpatialPoints(Snow.deaths[,c("x","y")]) plot(Snow.deaths.sp, add=TRUE, col ='red', pch=15, cex=0.6)# pumps spp <- SpatialPoints(Snow.pumps[,c("x","y")]) Snow.pumps.sp <- SpatialPointsDataFrame(spp,Snow.pumps[,c("x","y")]) plot(Snow.pumps.sp, add=TRUE, col='blue', pch=17, cex=1.5) text(Snow.pumps[,c("x","y")], labels=Snow.pumps$label, pos=1, cex=0.8)
--

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