R Dataset / Package HistData / Wheat.monarchs

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-77745.csv 310 bytes
Dataset License
GNU General Public License v2.0
Documentation

Playfair's Data on Wages and the Price of Wheat

Description

Playfair (1821) used a graph, showing parallel time-series of the price of wheat and the typical weekly wage for a "good mechanic" from 1565 to 1821 to argue that working men had never been as well-off in terms of purchasing power as they had become toward the end of this period.

His graph is a classic in the history of data visualization, but commits the sin of showing two non-commensurable Y variables on different axes. Scatterplots of wages vs. price or plots of ratios (e.g., wages/price) are in some ways better, but both of these ideas were unknown in 1821.

In this version, information on the reigns of British monarchs is provided in a separate data.frame, Wheat.monarch.

Usage

data(Wheat)
data(Wheat.monarchs)

Format

WheatA data frame with 53 observations on the following 3 variables.

Year

Year, in intervals of 5 from 1565 to 1821: a numeric vector

Wheat

Price of Wheat (Shillings/Quarter bushel): a numeric vector

Wages

Weekly wage (Shillings): a numeric vector

Wheat.monarchs A data frame with 12 observations on the following 4 variables.

name

Reigning monarch, a factor with levels Anne Charles I Charles II Cromwell Elizabeth George I George II George III George IV James I James II W&M

start

Starting year of reign, a numeric vector

end

Starting year of reign, a numeric vector

commonwealth

A binary variable indicating the period of the Commonwealth under Cromwell

Source

Playfair, W. (1821). Letter on our Agricultural Distresses, Their Causes and Remedies. London: W. Sams, 1821

Data values: originally digitized from http://www.math.yorku.ca/SCS/Gallery/images/playfair-wheat1.gif now taken from http://mbostock.github.com/protovis/ex/wheat.js

References

Friendly, M. & Denis, D. (2005). The early origins and development of the scatterplot Journal of the History of the Behavioral Sciences, 41, 103-130.

Examples

data(Wheat)data(Wheat)# ------------------------------------
# Playfair's graph, largely reproduced
# ------------------------------------# convenience function to fill area under a curve down to a minimum value
fillpoly <- function(x,y, low=min(y),  ...) {
    n <- length(x)
    polygon( c(x, x[n], x[1]), c(y, low, low), ...)
}# For best results, this graph should be viewed with width ~ 2 * height
# Note use of type='s' to plot a step function for Wheat
#   and panel.first to provide a background grid()
#     The curve for Wages is plotted after the polygon below it is filled
with(Wheat, {
    plot(Year, Wheat, type="s", ylim=c(0,105), 
        ylab="Price of the Quarter of Wheat (shillings)", 
        panel.first=grid(col=gray(.9), lty=1))
    fillpoly(Year, Wages, low=0, col="lightskyblue", border=NA)
    lines(Year, Wages, lwd=3, col="red")
    })
# add some annotations
text(1625,10, "Weekly wages of a good mechanic", cex=0.8, srt=3, col="red")# cartouche
text(1650, 85, "Chart", cex=2, font=2)
text(1650, 70, 
	paste("Shewing at One View", 
        "The Price of the Quarter of Wheat", 
        "& Wages of Labor by the Week", 
        "from the Year 1565 to 1821",
        "by William Playfair",
        sep="\n"), font=3)# add the time series bars to show reigning monarchs
# distinguish Cromwell visually, as Playfair did
with(Wheat.monarchs, {
	y <- ifelse( !commonwealth & (!seq_along(start) %% 2), 102, 104)
	segments(start, y, end, y, col="black", lwd=7, lend=1)
	segments(start, y, end, y, col=ifelse(commonwealth, "white", NA), lwd=4, lend=1)
	text((start+end)/2, y-2, name, cex=0.5)
	})# -----------------------------------------
# plot the labor cost of a quarter of wheat
# -----------------------------------------
Wheat1 <- within(na.omit(Wheat), {Labor=Wheat/Wages})
with(Wheat1, {
	plot(Year, Labor, type='b', pch=16, cex=1.5, lwd=1.5, 
	     ylab="Labor cost of a Quarter of Wheat (weeks)",
	     ylim=c(1,12.5));
	lines(lowess(Year, Labor), col="red", lwd=2)
	})
	
# cartouche
text(1740, 10, "Chart", cex=2, font=2)
text(1740, 8.5, 
	paste("Shewing at One View", 
        "The Work Required to Purchase", 
        "One Quarter of Wheat", 
        sep="\n"), cex=1.5, font=3)with(Wheat.monarchs, {
	y <- ifelse( !commonwealth & (!seq_along(start) %% 2), 12.3, 12.5)
	segments(start, y, end, y, col="black", lwd=7, lend=1)
	segments(start, y, end, y, col=ifelse(commonwealth, "white", NA), lwd=4, lend=1)
	text((start+end)/2, y-0.2, name, cex=0.5)
	})
--

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 psych / blot March 9, 2018 - 1:06 PM Dataset
R Dataset / Package car / AMSsurvey March 9, 2018 - 1:06 PM Dataset
R Dataset / Package Ecdat / CPSch3 March 9, 2018 - 1:06 PM Dataset
R Dataset / Package MASS / caith March 9, 2018 - 1:06 PM Dataset
R Dataset / Package boot / survival March 9, 2018 - 1:06 PM Dataset