Data

Data sets

  • Generally contains information about many subjects.
  • Each subject may be observed multiple times.
  • Each time we collect data about a subject, we are making an observation.
  • Each observation may consist of one or more pieces of information, called variables.

Examples

  • A nurse measures each patient’s vitals, such as temperature, pulse, and blood pressure.
  • A teacher records student’s grade and a completion time on an assignment.
  • A bank records the amount of money withdrawn by each customer, together with the location, date and time of the withdrawal.
  • The NOAA National Hurricane Center collects the position, sustained wind speed, minimum central pressure, date and time for each tropical storm.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

This is data from the “Get it dunn run” race in Menomonie, WI, from 2017 and 2018.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Each row corresponds to one runner in one race. These are the observations.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Each row corresponds to one runner in one race. These are the observations.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Each row corresponds to one runner in one race. These are the observations.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

The first column contains the row numbers.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

This indicates there are rows that are not shown.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

There are 978 observations.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Each observation consists of 10 variables.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Each variable is contained in one column. The first one is the date of the run.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

The second is the run distance, or type of race.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

The bib number of the runner.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

First number of the runner.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Initial of the runner’s last name.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Sex of the runner.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Age of the runner.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

City of residence of the runner.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

State of residence of the runner.

Runner Data

Date Race Bib_num First_name Last_initial Sex Age City State Runtime
1 2017-05-13 5k 1690 Jeff A M 58 Menomonie WI 59.473
2 2017-05-13 5k 1691 Julie A F 57 Menomonie WI 59.4627
3 2017-05-13 5k 1692 Aimothy A F 47 Menomonie WI 36.5303
4 2017-05-13 5k 1878 Ashley A F 32 Cadott WI 33.2705
5 2017-05-13 5k 1906 Bob A M 59 Boyd WI 56.6825
... ... ... ... ... ... ... ... ... ... ...
976 2018-05-12 half-marathon 4412 Richard G M 51 Menominee WI 90.2363
977 2018-05-12 half-marathon 4413 Kevin L M 39 Altoona WI 82.6103
978 2018-05-12 half-marathon 4414 meredith b F 34 Eau Claire WI 139.7265

Run time, in minutes.

Tidy Data

  • Each observation correspond to a single row, and vice versa.
  • Each variable corresponds to a single column, and vice versa.

This is called a tidy format, and data in this format is called tidy data.

Summary

  • A data set consists of a number of observations.
  • Each observation consists of values of one or more variables.
  • In a tidy data:
    • Each row is an observation
    • Each column is a variable

Numerical Variables

(Also known as quantitative). Quantities, measurements, counts, …

  • Height: 5’4”, 5’3 1/2, 63.5 inches, 172.4 centimeters, …

    • Continuous numerical variables
    • Usually measurements
  • Number od students in a class, number of books an author published, …

    • Discrete numerical variables
    • Usually counts

Categorical variables

Categories, names, words, labels, …

  • Some have a small fixed number of possible values:

    • Gender, Ethnicity, Type of race, Class, College
    • These are called factors or factor variables.
  • Some do not have fixed possible values, or the number of options is large:

    • Favorite color, Major, Name of a book, …
    • Usually called “character” or “string” variables.

Categorical Variables

Factor:

What is your class?

String:

What is your favorite color?

Two Types of Factors

There is an important difference between the Class variable and the College variable:

  • The values of age.cohort have a clear natural order.

    Another example is Class:

    • Freshperson, then Sophomore, then Junior, then Senior
    • This is called an ordered or ordinal factor.
  • There is no natural order of the ethnicities, genders, …

    • This is often called a nominal factor or nominal variable.

Types of variables

VariablesNumericalContinuousDiscreteCategoricalFactorStringOrdinalNominal

Other “Special” Types

  • Dates and times
  • Logical values (True/False, Yes/No, …)

Not Set in Stone

  • Factors with many values: country of origin, academic major
  • “Numerical” scales: on the scale from 0 to 10, …
  • Age: discrete or continuous?
  • Height: often rounded to the nearest inch