R and Quarto

Modern Plain Text Social Science: Week 4

Kieran Healy

October 29, 2024

Your Workbench

RStudio is an IDE for R

A kitchen is an IDE for Meals

R and RStudio

RStudio at startup

RStudio schematic overview

RStudio schematic overview

Think in terms of Data + Transformations, written out as code, rather than a series of point-and-click steps

Our starting data + our code is what’s “real” in our projects, not the final output or any intermediate objects

The IDE is the thing that helps us keep track of and control over the code we write and the outputs we produce.

RStudio at startup

RStudio at startup

RStudio at startup

RStudio at startup

RStudio at startup

Your code is what’s real in your project

Consider not showing output inline

Writing documents

Use Quarto to produce and reproduce your work

Where we want to end up

PDF out

Where we want to end up

HTML out

Where we want to end up

Word out

How to get there?

  • We could write an R script with some notes inside, using it to create some figures and tables, paste them into our document.
  • This will work well. The more complex our projects get the more likely it is we will write code like this. It will also look less and less like a single all-in-one-breath script and more like a structured collection R files that combine to do many things.
  • But to begin we can also do things a little differently, by taking a more notebook-based approach. For many simpler and routine uses, this will be better.

We can make this …

… by writing this

The code gets replaced by its output

This way of doing things is called a Literate Programming or Notebook approach.

A Quarto file with markdown and code chunks

A Quarto file with markdown and code chunks, annotated

  • This approach has its limitations, which we will return to, but it’s very useful and has many benefits.

Strengths and weaknesses

Notebooks work smoothly when

  • Your document or report is small and self-contained.
  • Your analysis is quick or lightweight.
  • You are making slides.
  • You are making a lot of similar reports from a template.
  • You regularly refer to calculated items in the text of your analysis.

Notebooks can get awkward when

  • Your analysis has many pieces.
  • Your project has many authors.
  • Your analysis needs a lot of scaffolding in code.
  • You have a lot of different outputs.

In Practice

Notebook-style documents like Quarto files are great as part of larger projects. The more complex your project, the less likely it will straightforwardly fit into a single notebook. More likely you will find yourself, first, splitting parts of a complex project up into different notebooks; and then, second, writing R scripts that programatically clean and pre-process data, run analyses, and produce some outputs—such as key tables and figures—that you then incorporate into a Quarto document indirectly. Not by copying and pasting, but by pointing to those outputs.

Basic markdown summary

Desired style Use the following Markdown annotation
Heading 1 # Heading 1
Heading 2 ## Heading 2
Heading 3 ### Heading 3 (Actual heading styles will vary.)
Paragraph Just start typing
Bold **Bold**
Italic *Italic*
Images [Alternate text for image](path/image.jpg)
Hyperlinks [Link text](https://www.visualizingsociety.com/)
Unordered Lists
- First - First
- Second. - Second
- Third - Third
Ordered Lists
1. First 1. First
2. Second. 2. Second
3. Third 3. Third
Footnote.¹ Footnote[^notelabel]
¹The note’s content. [^notelabel] The note's content.

The right frame of mind

  • This is like learning how to drive a car, or how to cook in a kitchen … or learning to speak a language.
  • After some orientation to what’s where, you will learn best by doing.
  • Software is a pain, but you won’t crash the car or burn your house down.

TYPE OUT
YOUR CODE
BY HAND

Samuel Beckett

Getting Oriented

Before we start

  • Keep in mind the kinds of things we want to do.
  • In particular, we are constantly working with rectangular tables of data consisting of columns with information about variables
  • We want to do things like group, summarize, count, tally, calculate, model or otherwise work on these columns, singly or all at once.
  • Once we learn how to do things like count up the number of rows within a group, or take the average of the values in a column, we will find that we are just a step or two away from doing much more complex operations in essentially the same fashion.

Split

Apply

Combine

Before we start

gapminder
# A tibble: 1,704 × 6
   country     continent  year lifeExp      pop gdpPercap
   <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
 1 Afghanistan Asia       1952    28.8  8425333      779.
 2 Afghanistan Asia       1957    30.3  9240934      821.
 3 Afghanistan Asia       1962    32.0 10267083      853.
 4 Afghanistan Asia       1967    34.0 11537966      836.
 5 Afghanistan Asia       1972    36.1 13079460      740.
 6 Afghanistan Asia       1977    38.4 14880372      786.
 7 Afghanistan Asia       1982    39.9 12881816      978.
 8 Afghanistan Asia       1987    40.8 13867957      852.
 9 Afghanistan Asia       1992    41.7 16317921      649.
10 Afghanistan Asia       1997    41.8 22227415      635.
# ℹ 1,694 more rows

Before we start

Country Continent Year Lifeexp Pop Gdppercap
Afghanistan Asia 1952 28.8 8425333 779.4
Afghanistan Asia 1957 30.3 9240934 820.9
Afghanistan Asia 1962 32.0 10267083 853.1
Afghanistan Asia 1967 34.0 11537966 836.2
Afghanistan Asia 1972 36.1 13079460 740.0
Afghanistan Asia 1977 38.4 14880372 786.1
Afghanistan Asia 1982 39.9 12881816 978.0
Afghanistan Asia 1987 40.8 13867957 852.4
Afghanistan Asia 1992 41.7 16317921 649.3
Afghanistan Asia 1997 41.8 22227415 635.3
Afghanistan Asia 2002 42.1 25268405 726.7
Afghanistan Asia 2007 43.8 31889923 974.6
Albania Europe 1952 55.2 1282697 1601.1
Albania Europe 1957 59.3 1476505 1942.3
Albania Europe 1962 64.8 1728137 2312.9
Albania Europe 1967 66.2 1984060 2760.2
Albania Europe 1972 67.7 2263554 3313.4
Albania Europe 1977 68.9 2509048 3533.0
Albania Europe 1982 70.4 2780097 3630.9
Albania Europe 1987 72.0 3075321 3738.9
Albania Europe 1992 71.6 3326498 2497.4
Albania Europe 1997 73.0 3428038 3193.1
Albania Europe 2002 75.7 3508512 4604.2
Albania Europe 2007 76.4 3600523 5937.0
Algeria Africa 1952 43.1 9279525 2449.0
Algeria Africa 1957 45.7 10270856 3014.0
Algeria Africa 1962 48.3 11000948 2550.8
Algeria Africa 1967 51.4 12760499 3247.0
Algeria Africa 1972 54.5 14760787 4182.7
Algeria Africa 1977 58.0 17152804 4910.4
Algeria Africa 1982 61.4 20033753 5745.2
Algeria Africa 1987 65.8 23254956 5681.4
Algeria Africa 1992 67.7 26298373 5023.2
Algeria Africa 1997 69.2 29072015 4797.3
Algeria Africa 2002 71.0 31287142 5288.0
Algeria Africa 2007 72.3 33333216 6223.4
Angola Africa 1952 30.0 4232095 3520.6
Angola Africa 1957 32.0 4561361 3827.9
Angola Africa 1962 34.0 4826015 4269.3
Angola Africa 1967 36.0 5247469 5522.8
Angola Africa 1972 37.9 5894858 5473.3
Angola Africa 1977 39.5 6162675 3008.6
Angola Africa 1982 39.9 7016384 2757.0
Angola Africa 1987 39.9 7874230 2430.2
Angola Africa 1992 40.6 8735988 2627.8
Angola Africa 1997 41.0 9875024 2277.1
Angola Africa 2002 41.0 10866106 2773.3
Angola Africa 2007 42.7 12420476 4797.2
Argentina Americas 1952 62.5 17876956 5911.3
Argentina Americas 1957 64.4 19610538 6856.9
Argentina Americas 1962 65.1 21283783 7133.2
Argentina Americas 1967 65.6 22934225 8053.0
Argentina Americas 1972 67.1 24779799 9443.0
Argentina Americas 1977 68.5 26983828 10079.0
Argentina Americas 1982 69.9 29341374 8997.9
Argentina Americas 1987 70.8 31620918 9139.7
Argentina Americas 1992 71.9 33958947 9308.4
Argentina Americas 1997 73.3 36203463 10967.3
Argentina Americas 2002 74.3 38331121 8797.6
Argentina Americas 2007 75.3 40301927 12779.4
Australia Oceania 1952 69.1 8691212 10039.6
Australia Oceania 1957 70.3 9712569 10949.6
Australia Oceania 1962 70.9 10794968 12217.2
Australia Oceania 1967 71.1 11872264 14526.1
Australia Oceania 1972 71.9 13177000 16788.6
Australia Oceania 1977 73.5 14074100 18334.2
Australia Oceania 1982 74.7 15184200 19477.0
Australia Oceania 1987 76.3 16257249 21888.9
Australia Oceania 1992 77.6 17481977 23424.8
Australia Oceania 1997 78.8 18565243 26997.9
Australia Oceania 2002 80.4 19546792 30687.8
Australia Oceania 2007 81.2 20434176 34435.4
Austria Europe 1952 66.8 6927772 6137.1
Austria Europe 1957 67.5 6965860 8842.6
Austria Europe 1962 69.5 7129864 10750.7
Austria Europe 1967 70.1 7376998 12834.6
Austria Europe 1972 70.6 7544201 16661.6
Austria Europe 1977 72.2 7568430 19749.4
Austria Europe 1982 73.2 7574613 21597.1
Austria Europe 1987 74.9 7578903 23687.8
Austria Europe 1992 76.0 7914969 27042.0
Austria Europe 1997 77.5 8069876 29095.9
Austria Europe 2002 79.0 8148312 32417.6
Austria Europe 2007 79.8 8199783 36126.5
Bahrain Asia 1952 50.9 120447 9867.1
Bahrain Asia 1957 53.8 138655 11635.8
Bahrain Asia 1962 56.9 171863 12753.3
Bahrain Asia 1967 59.9 202182 14804.7
Bahrain Asia 1972 63.3 230800 18268.7
Bahrain Asia 1977 65.6 297410 19340.1
Bahrain Asia 1982 69.1 377967 19211.1
Bahrain Asia 1987 70.8 454612 18524.0
Bahrain Asia 1992 72.6 529491 19035.6
Bahrain Asia 1997 73.9 598561 20292.0
Bahrain Asia 2002 74.8 656397 23403.6
Bahrain Asia 2007 75.6 708573 29796.0
Bangladesh Asia 1952 37.5 46886859 684.2
Bangladesh Asia 1957 39.3 51365468 661.6
Bangladesh Asia 1962 41.2 56839289 686.3
Bangladesh Asia 1967 43.5 62821884 721.2
Bangladesh Asia 1972 45.3 70759295 630.2
Bangladesh Asia 1977 46.9 80428306 659.9
Bangladesh Asia 1982 50.0 93074406 677.0
Bangladesh Asia 1987 52.8 103764241 752.0
Bangladesh Asia 1992 56.0 113704579 837.8
Bangladesh Asia 1997 59.4 123315288 972.8
Bangladesh Asia 2002 62.0 135656790 1136.4
Bangladesh Asia 2007 64.1 150448339 1391.3
Belgium Europe 1952 68.0 8730405 8343.1
Belgium Europe 1957 69.2 8989111 9715.0
Belgium Europe 1962 70.2 9218400 10991.2
Belgium Europe 1967 70.9 9556500 13149.0
Belgium Europe 1972 71.4 9709100 16672.1
Belgium Europe 1977 72.8 9821800 19118.0
Belgium Europe 1982 73.9 9856303 20979.8
Belgium Europe 1987 75.3 9870200 22525.6
Belgium Europe 1992 76.5 10045622 25575.6
Belgium Europe 1997 77.5 10199787 27561.2
Belgium Europe 2002 78.3 10311970 30485.9
Belgium Europe 2007 79.4 10392226 33692.6
Benin Africa 1952 38.2 1738315 1062.8
Benin Africa 1957 40.4 1925173 959.6
Benin Africa 1962 42.6 2151895 949.5
Benin Africa 1967 44.9 2427334 1035.8
Benin Africa 1972 47.0 2761407 1085.8
Benin Africa 1977 49.2 3168267 1029.2
Benin Africa 1982 50.9 3641603 1277.9
Benin Africa 1987 52.3 4243788 1225.9
Benin Africa 1992 53.9 4981671 1191.2
Benin Africa 1997 54.8 6066080 1233.0
Benin Africa 2002 54.4 7026113 1372.9
Benin Africa 2007 56.7 8078314 1441.3
Bolivia Americas 1952 40.4 2883315 2677.3
Bolivia Americas 1957 41.9 3211738 2127.7
Bolivia Americas 1962 43.4 3593918 2181.0
Bolivia Americas 1967 45.0 4040665 2586.9
Bolivia Americas 1972 46.7 4565872 2980.3
Bolivia Americas 1977 50.0 5079716 3548.1
Bolivia Americas 1982 53.9 5642224 3156.5
Bolivia Americas 1987 57.3 6156369 2753.7
Bolivia Americas 1992 60.0 6893451 2961.7
Bolivia Americas 1997 62.0 7693188 3326.1
Bolivia Americas 2002 63.9 8445134 3413.3
Bolivia Americas 2007 65.6 9119152 3822.1
Bosnia and Herzegovina Europe 1952 53.8 2791000 973.5
Bosnia and Herzegovina Europe 1957 58.5 3076000 1354.0
Bosnia and Herzegovina Europe 1962 61.9 3349000 1709.7
Bosnia and Herzegovina Europe 1967 64.8 3585000 2172.4
Bosnia and Herzegovina Europe 1972 67.4 3819000 2860.2
Bosnia and Herzegovina Europe 1977 69.9 4086000 3528.5
Bosnia and Herzegovina Europe 1982 70.7 4172693 4126.6
Bosnia and Herzegovina Europe 1987 71.1 4338977 4314.1
Bosnia and Herzegovina Europe 1992 72.2 4256013 2546.8
Bosnia and Herzegovina Europe 1997 73.2 3607000 4766.4
Bosnia and Herzegovina Europe 2002 74.1 4165416 6019.0
Bosnia and Herzegovina Europe 2007 74.9 4552198 7446.3
Botswana Africa 1952 47.6 442308 851.2
Botswana Africa 1957 49.6 474639 918.2
Botswana Africa 1962 51.5 512764 983.7
Botswana Africa 1967 53.3 553541 1214.7
Botswana Africa 1972 56.0 619351 2263.6
Botswana Africa 1977 59.3 781472 3214.9
Botswana Africa 1982 61.5 970347 4551.1
Botswana Africa 1987 63.6 1151184 6205.9
Botswana Africa 1992 62.7 1342614 7954.1
Botswana Africa 1997 52.6 1536536 8647.1
Botswana Africa 2002 46.6 1630347 11003.6
Botswana Africa 2007 50.7 1639131 12569.9
Brazil Americas 1952 50.9 56602560 2108.9
Brazil Americas 1957 53.3 65551171 2487.4
Brazil Americas 1962 55.7 76039390 3336.6
Brazil Americas 1967 57.6 88049823 3429.9
Brazil Americas 1972 59.5 100840058 4985.7
Brazil Americas 1977 61.5 114313951 6660.1
Brazil Americas 1982 63.3 128962939 7030.8
Brazil Americas 1987 65.2 142938076 7807.1
Brazil Americas 1992 67.1 155975974 6950.3
Brazil Americas 1997 69.4 168546719 7958.0
Brazil Americas 2002 71.0 179914212 8131.2
Brazil Americas 2007 72.4 190010647 9065.8
Bulgaria Europe 1952 59.6 7274900 2444.3
Bulgaria Europe 1957 66.6 7651254 3008.7
Bulgaria Europe 1962 69.5 8012946 4254.3
Bulgaria Europe 1967 70.4 8310226 5577.0
Bulgaria Europe 1972 70.9 8576200 6597.5
Bulgaria Europe 1977 70.8 8797022 7612.2
Bulgaria Europe 1982 71.1 8892098 8224.2
Bulgaria Europe 1987 71.3 8971958 8239.9
Bulgaria Europe 1992 71.2 8658506 6302.6
Bulgaria Europe 1997 70.3 8066057 5970.4
Bulgaria Europe 2002 72.1 7661799 7696.8
Bulgaria Europe 2007 73.0 7322858 10680.8
Burkina Faso Africa 1952 32.0 4469979 543.3
Burkina Faso Africa 1957 34.9 4713416 617.2
Burkina Faso Africa 1962 37.8 4919632 722.5
Burkina Faso Africa 1967 40.7 5127935 794.8
Burkina Faso Africa 1972 43.6 5433886 854.7
Burkina Faso Africa 1977 46.1 5889574 743.4
Burkina Faso Africa 1982 48.1 6634596 807.2
Burkina Faso Africa 1987 49.6 7586551 912.1
Burkina Faso Africa 1992 50.3 8878303 931.8
Burkina Faso Africa 1997 50.3 10352843 946.3
Burkina Faso Africa 2002 50.6 12251209 1037.6
Burkina Faso Africa 2007 52.3 14326203 1217.0
Burundi Africa 1952 39.0 2445618 339.3
Burundi Africa 1957 40.5 2667518 379.6
Burundi Africa 1962 42.0 2961915 355.2
Burundi Africa 1967 43.5 3330989 413.0
Burundi Africa 1972 44.1 3529983 464.1
Burundi Africa 1977 45.9 3834415 556.1
Burundi Africa 1982 47.5 4580410 559.6
Burundi Africa 1987 48.2 5126023 621.8
Burundi Africa 1992 44.7 5809236 631.7
Burundi Africa 1997 45.3 6121610 463.1
Burundi Africa 2002 47.4 7021078 446.4
Burundi Africa 2007 49.6 8390505 430.1
Cambodia Asia 1952 39.4 4693836 368.5
Cambodia Asia 1957 41.4 5322536 434.0
Cambodia Asia 1962 43.4 6083619 496.9
Cambodia Asia 1967 45.4 6960067 523.4
Cambodia Asia 1972 40.3 7450606 421.6
Cambodia Asia 1977 31.2 6978607 525.0
Cambodia Asia 1982 51.0 7272485 624.5
Cambodia Asia 1987 53.9 8371791 683.9
Cambodia Asia 1992 55.8 10150094 682.3
Cambodia Asia 1997 56.5 11782962 734.3
Cambodia Asia 2002 56.8 12926707 896.2
Cambodia Asia 2007 59.7 14131858 1713.8
Cameroon Africa 1952 38.5 5009067 1172.7
Cameroon Africa 1957 40.4 5359923 1313.0
Cameroon Africa 1962 42.6 5793633 1399.6
Cameroon Africa 1967 44.8 6335506 1508.5
Cameroon Africa 1972 47.0 7021028 1684.1
Cameroon Africa 1977 49.4 7959865 1783.4
Cameroon Africa 1982 53.0 9250831 2368.0
Cameroon Africa 1987 55.0 10780667 2602.7
Cameroon Africa 1992 54.3 12467171 1793.2
Cameroon Africa 1997 52.2 14195809 1694.3
Cameroon Africa 2002 49.9 15929988 1934.0
Cameroon Africa 2007 50.4 17696293 2042.1
Canada Americas 1952 68.8 14785584 11367.2
Canada Americas 1957 70.0 17010154 12490.0
Canada Americas 1962 71.3 18985849 13462.5
Canada Americas 1967 72.1 20819767 16076.6
Canada Americas 1972 72.9 22284500 18970.6
Canada Americas 1977 74.2 23796400 22090.9
Canada Americas 1982 75.8 25201900 22898.8
Canada Americas 1987 76.9 26549700 26626.5
Canada Americas 1992 78.0 28523502 26342.9
Canada Americas 1997 78.6 30305843 28954.9
Canada Americas 2002 79.8 31902268 33329.0
Canada Americas 2007 80.7 33390141 36319.2
Central African Republic Africa 1952 35.5 1291695 1071.3
Central African Republic Africa 1957 37.5 1392284 1190.8
Central African Republic Africa 1962 39.5 1523478 1193.1
Central African Republic Africa 1967 41.5 1733638 1136.1
Central African Republic Africa 1972 43.5 1927260 1070.0
Central African Republic Africa 1977 46.8 2167533 1109.4
Central African Republic Africa 1982 48.3 2476971 956.8
Central African Republic Africa 1987 50.5 2840009 844.9
Central African Republic Africa 1992 49.4 3265124 747.9
Central African Republic Africa 1997 46.1 3696513 740.5
Central African Republic Africa 2002 43.3 4048013 738.7
Central African Republic Africa 2007 44.7 4369038 706.0
Chad Africa 1952 38.1 2682462 1178.7
Chad Africa 1957 39.9 2894855 1308.5
Chad Africa 1962 41.7 3150417 1389.8
Chad Africa 1967 43.6 3495967 1196.8
Chad Africa 1972 45.6 3899068 1104.1
Chad Africa 1977 47.4 4388260 1134.0
Chad Africa 1982 49.5 4875118 797.9
Chad Africa 1987 51.1 5498955 952.4
Chad Africa 1992 51.7 6429417 1058.1
Chad Africa 1997 51.6 7562011 1005.0
Chad Africa 2002 50.5 8835739 1156.2
Chad Africa 2007 50.7 10238807 1704.1
Chile Americas 1952 54.7 6377619 3940.0
Chile Americas 1957 56.1 7048426 4315.6
Chile Americas 1962 57.9 7961258 4519.1
Chile Americas 1967 60.5 8858908 5106.7
Chile Americas 1972 63.4 9717524 5494.0
Chile Americas 1977 67.1 10599793 4756.8
Chile Americas 1982 70.6 11487112 5095.7
Chile Americas 1987 72.5 12463354 5547.1
Chile Americas 1992 74.1 13572994 7596.1
Chile Americas 1997 75.8 14599929 10118.1
Chile Americas 2002 77.9 15497046 10778.8
Chile Americas 2007 78.6 16284741 13171.6
China Asia 1952 44.0 556263527 400.4
China Asia 1957 50.5 637408000 576.0
China Asia 1962 44.5 665770000 487.7
China Asia 1967 58.4 754550000 612.7
China Asia 1972 63.1 862030000 676.9
China Asia 1977 64.0 943455000 741.2
China Asia 1982 65.5 1000281000 962.4
China Asia 1987 67.3 1084035000 1378.9
China Asia 1992 68.7 1164970000 1655.8
China Asia 1997 70.4 1230075000 2289.2
China Asia 2002 72.0 1280400000 3119.3
China Asia 2007 73.0 1318683096 4959.1
Colombia Americas 1952 50.6 12350771 2144.1
Colombia Americas 1957 55.1 14485993 2323.8
Colombia Americas 1962 57.9 17009885 2492.4
Colombia Americas 1967 60.0 19764027 2678.7
Colombia Americas 1972 61.6 22542890 3264.7
Colombia Americas 1977 63.8 25094412 3815.8
Colombia Americas 1982 66.7 27764644 4397.6
Colombia Americas 1987 67.8 30964245 4903.2
Colombia Americas 1992 68.4 34202721 5444.6
Colombia Americas 1997 70.3 37657830 6117.4
Colombia Americas 2002 71.7 41008227 5755.3
Colombia Americas 2007 72.9 44227550 7006.6
Comoros Africa 1952 40.7 153936 1103.0
Comoros Africa 1957 42.5 170928 1211.1
Comoros Africa 1962 44.5 191689 1406.6
Comoros Africa 1967 46.5 217378 1876.0
Comoros Africa 1972 48.9 250027 1937.6
Comoros Africa 1977 50.9 304739 1172.6
Comoros Africa 1982 52.9 348643 1267.1
Comoros Africa 1987 54.9 395114 1316.0
Comoros Africa 1992 57.9 454429 1246.9
Comoros Africa 1997 60.7 527982 1173.6
Comoros Africa 2002 63.0 614382 1075.8
Comoros Africa 2007 65.2 710960 986.1
Congo, Dem. Rep. Africa 1952 39.1 14100005 780.5
Congo, Dem. Rep. Africa 1957 40.7 15577932 905.9
Congo, Dem. Rep. Africa 1962 42.1 17486434 896.3
Congo, Dem. Rep. Africa 1967 44.1 19941073 861.6
Congo, Dem. Rep. Africa 1972 46.0 23007669 904.9
Congo, Dem. Rep. Africa 1977 47.8 26480870 795.8
Congo, Dem. Rep. Africa 1982 47.8 30646495 673.7
Congo, Dem. Rep. Africa 1987 47.4 35481645 672.8
Congo, Dem. Rep. Africa 1992 45.5 41672143 457.7
Congo, Dem. Rep. Africa 1997 42.6 47798986 312.2
Congo, Dem. Rep. Africa 2002 45.0 55379852 241.2
Congo, Dem. Rep. Africa 2007 46.5 64606759 277.6
Congo, Rep. Africa 1952 42.1 854885 2125.6
Congo, Rep. Africa 1957 45.1 940458 2315.1
Congo, Rep. Africa 1962 48.4 1047924 2464.8
Congo, Rep. Africa 1967 52.0 1179760 2677.9
Congo, Rep. Africa 1972 54.9 1340458 3213.2
Congo, Rep. Africa 1977 55.6 1536769 3259.2
Congo, Rep. Africa 1982 56.7 1774735 4879.5
Congo, Rep. Africa 1987 57.5 2064095 4201.2
Congo, Rep. Africa 1992 56.4 2409073 4016.2
Congo, Rep. Africa 1997 53.0 2800947 3484.2
Congo, Rep. Africa 2002 53.0 3328795 3484.1
Congo, Rep. Africa 2007 55.3 3800610 3632.6
Costa Rica Americas 1952 57.2 926317 2627.0
Costa Rica Americas 1957 60.0 1112300 2990.0
Costa Rica Americas 1962 62.8 1345187 3460.9
Costa Rica Americas 1967 65.4 1588717 4161.7
Costa Rica Americas 1972 67.8 1834796 5118.1
Costa Rica Americas 1977 70.8 2108457 5926.9
Costa Rica Americas 1982 73.4 2424367 5262.7
Costa Rica Americas 1987 74.8 2799811 5629.9
Costa Rica Americas 1992 75.7 3173216 6160.4
Costa Rica Americas 1997 77.3 3518107 6677.0
Costa Rica Americas 2002 78.1 3834934 7723.4
Costa Rica Americas 2007 78.8 4133884 9645.1
Cote d'Ivoire Africa 1952 40.5 2977019 1388.6
Cote d'Ivoire Africa 1957 42.5 3300000 1500.9
Cote d'Ivoire Africa 1962 44.9 3832408 1728.9
Cote d'Ivoire Africa 1967 47.4 4744870 2052.1
Cote d'Ivoire Africa 1972 49.8 6071696 2378.2
Cote d'Ivoire Africa 1977 52.4 7459574 2517.7
Cote d'Ivoire Africa 1982 54.0 9025951 2602.7
Cote d'Ivoire Africa 1987 54.7 10761098 2157.0
Cote d'Ivoire Africa 1992 52.0 12772596 1648.1
Cote d'Ivoire Africa 1997 48.0 14625967 1786.3
Cote d'Ivoire Africa 2002 46.8 16252726 1648.8
Cote d'Ivoire Africa 2007 48.3 18013409 1544.8
Croatia Europe 1952 61.2 3882229 3119.2
Croatia Europe 1957 64.8 3991242 4338.2
Croatia Europe 1962 67.1 4076557 5477.9
Croatia Europe 1967 68.5 4174366 6960.3
Croatia Europe 1972 69.6 4225310 9164.1
Croatia Europe 1977 70.6 4318673 11305.4
Croatia Europe 1982 70.5 4413368 13221.8
Croatia Europe 1987 71.5 4484310 13822.6
Croatia Europe 1992 72.5 4494013 8447.8
Croatia Europe 1997 73.7 4444595 9875.6
Croatia Europe 2002 74.9 4481020 11628.4
Croatia Europe 2007 75.7 4493312 14619.2
Cuba Americas 1952 59.4 6007797 5586.5
Cuba Americas 1957 62.3 6640752 6092.2
Cuba Americas 1962 65.2 7254373 5180.8
Cuba Americas 1967 68.3 8139332 5690.3
Cuba Americas 1972 70.7 8831348 5305.4
Cuba Americas 1977 72.6 9537988 6380.5
Cuba Americas 1982 73.7 9789224 7316.9
Cuba Americas 1987 74.2 10239839 7532.9
Cuba Americas 1992 74.4 10723260 5592.8
Cuba Americas 1997 76.2 10983007 5432.0
Cuba Americas 2002 77.2 11226999 6340.6
Cuba Americas 2007 78.3 11416987 8948.1
Czech Republic Europe 1952 66.9 9125183 6876.1
Czech Republic Europe 1957 69.0 9513758 8256.3
Czech Republic Europe 1962 69.9 9620282 10136.9
Czech Republic Europe 1967 70.4 9835109 11399.4
Czech Republic Europe 1972 70.3 9862158 13108.5
Czech Republic Europe 1977 70.7 10161915 14800.2
Czech Republic Europe 1982 71.0 10303704 15377.2
Czech Republic Europe 1987 71.6 10311597 16310.4
Czech Republic Europe 1992 72.4 10315702 14297.0
Czech Republic Europe 1997 74.0 10300707 16048.5
Czech Republic Europe 2002 75.5 10256295 17596.2
Czech Republic Europe 2007 76.5 10228744 22833.3
Denmark Europe 1952 70.8 4334000 9692.4
Denmark Europe 1957 71.8 4487831 11099.7
Denmark Europe 1962 72.3 4646899 13583.3
Denmark Europe 1967 73.0 4838800 15937.2
Denmark Europe 1972 73.5 4991596 18866.2
Denmark Europe 1977 74.7 5088419 20422.9
Denmark Europe 1982 74.6 5117810 21688.0
Denmark Europe 1987 74.8 5127024 25116.2
Denmark Europe 1992 75.3 5171393 26406.7
Denmark Europe 1997 76.1 5283663 29804.3
Denmark Europe 2002 77.2 5374693 32166.5
Denmark Europe 2007 78.3 5468120 35278.4
Djibouti Africa 1952 34.8 63149 2669.5
Djibouti Africa 1957 37.3 71851 2865.0
Djibouti Africa 1962 39.7 89898 3021.0
Djibouti Africa 1967 42.1 127617 3020.1
Djibouti Africa 1972 44.4 178848 3694.2
Djibouti Africa 1977 46.5 228694 3081.8
Djibouti Africa 1982 48.8 305991 2879.5
Djibouti Africa 1987 50.0 311025 2880.1
Djibouti Africa 1992 51.6 384156 2377.2
Djibouti Africa 1997 53.2 417908 1895.0
Djibouti Africa 2002 53.4 447416 1908.3
Djibouti Africa 2007 54.8 496374 2082.5
Dominican Republic Americas 1952 45.9 2491346 1397.7
Dominican Republic Americas 1957 49.8 2923186 1544.4
Dominican Republic Americas 1962 53.5 3453434 1662.1
Dominican Republic Americas 1967 56.8 4049146 1653.7
Dominican Republic Americas 1972 59.6 4671329 2189.9
Dominican Republic Americas 1977 61.8 5302800 2682.0
Dominican Republic Americas 1982 63.7 5968349 2861.1
Dominican Republic Americas 1987 66.0 6655297 2899.8
Dominican Republic Americas 1992 68.5 7351181 3044.2
Dominican Republic Americas 1997 70.0 7992357 3614.1
Dominican Republic Americas 2002 70.8 8650322 4563.8
Dominican Republic Americas 2007 72.2 9319622 6025.4
Ecuador Americas 1952 48.4 3548753 3522.1
Ecuador Americas 1957 51.4 4058385 3780.5
Ecuador Americas 1962 54.6 4681707 4086.1
Ecuador Americas 1967 56.7 5432424 4579.1
Ecuador Americas 1972 58.8 6298651 5281.0
Ecuador Americas 1977 61.3 7278866 6679.6
Ecuador Americas 1982 64.3 8365850 7213.8
Ecuador Americas 1987 67.2 9545158 6481.8
Ecuador Americas 1992 69.6 10748394 7103.7
Ecuador Americas 1997 72.3 11911819 7429.5
Ecuador Americas 2002 74.2 12921234 5773.0
Ecuador Americas 2007 75.0 13755680 6873.3
Egypt Africa 1952 41.9 22223309 1418.8
Egypt Africa 1957 44.4 25009741 1458.9
Egypt Africa 1962 47.0 28173309 1693.3
Egypt Africa 1967 49.3 31681188 1814.9
Egypt Africa 1972 51.1 34807417 2024.0
Egypt Africa 1977 53.3 38783863 2785.5
Egypt Africa 1982 56.0 45681811 3503.7
Egypt Africa 1987 59.8 52799062 3885.5
Egypt Africa 1992 63.7 59402198 3794.8
Egypt Africa 1997 67.2 66134291 4173.2
Egypt Africa 2002 69.8 73312559 4754.6
Egypt Africa 2007 71.3 80264543 5581.2
El Salvador Americas 1952 45.3 2042865 3048.3
El Salvador Americas 1957 48.6 2355805 3421.5
El Salvador Americas 1962 52.3 2747687 3776.8
El Salvador Americas 1967 55.9 3232927 4358.6
El Salvador Americas 1972 58.2 3790903 4520.2
El Salvador Americas 1977 56.7 4282586 5138.9
El Salvador Americas 1982 56.6 4474873 4098.3
El Salvador Americas 1987 63.2 4842194 4140.4
El Salvador Americas 1992 66.8 5274649 4444.2
El Salvador Americas 1997 69.5 5783439 5154.8
El Salvador Americas 2002 70.7 6353681 5351.6
El Salvador Americas 2007 71.9 6939688 5728.4
Equatorial Guinea Africa 1952 34.5 216964 375.6
Equatorial Guinea Africa 1957 36.0 232922 426.1
Equatorial Guinea Africa 1962 37.5 249220 582.8
Equatorial Guinea Africa 1967 39.0 259864 915.6
Equatorial Guinea Africa 1972 40.5 277603 672.4
Equatorial Guinea Africa 1977 42.0 192675 958.6
Equatorial Guinea Africa 1982 43.7 285483 927.8
Equatorial Guinea Africa 1987 45.7 341244 966.9
Equatorial Guinea Africa 1992 47.5 387838 1132.1
Equatorial Guinea Africa 1997 48.2 439971 2814.5
Equatorial Guinea Africa 2002 49.3 495627 7703.5
Equatorial Guinea Africa 2007 51.6 551201 12154.1
Eritrea Africa 1952 35.9 1438760 328.9
Eritrea Africa 1957 38.0 1542611 344.2
Eritrea Africa 1962 40.2 1666618 381.0
Eritrea Africa 1967 42.2 1820319 468.8
Eritrea Africa 1972 44.1 2260187 514.3
Eritrea Africa 1977 44.5 2512642 505.8
Eritrea Africa 1982 43.9 2637297 524.9
Eritrea Africa 1987 46.5 2915959 521.1
Eritrea Africa 1992 50.0 3668440 582.9
Eritrea Africa 1997 53.4 4058319 913.5
Eritrea Africa 2002 55.2 4414865 765.4
Eritrea Africa 2007 58.0 4906585 641.4
Ethiopia Africa 1952 34.1 20860941 362.1
Ethiopia Africa 1957 36.7 22815614 378.9
Ethiopia Africa 1962 40.1 25145372 419.5
Ethiopia Africa 1967 42.1 27860297 516.1
Ethiopia Africa 1972 43.5 30770372 566.2
Ethiopia Africa 1977 44.5 34617799 556.8
Ethiopia Africa 1982 44.9 38111756 577.9
Ethiopia Africa 1987 46.7 42999530 573.7
Ethiopia Africa 1992 48.1 52088559 421.4
Ethiopia Africa 1997 49.4 59861301 515.9
Ethiopia Africa 2002 50.7 67946797 530.1
Ethiopia Africa 2007 52.9 76511887 690.8
Finland Europe 1952 66.6 4090500 6424.5
Finland Europe 1957 67.5 4324000 7545.4
Finland Europe 1962 68.8 4491443 9371.8
Finland Europe 1967 69.8 4605744 10921.6
Finland Europe 1972 70.9 4639657 14358.9
Finland Europe 1977 72.5 4738902 15605.4
Finland Europe 1982 74.6 4826933 18533.2
Finland Europe 1987 74.8 4931729 21141.0
Finland Europe 1992 75.7 5041039 20647.2
Finland Europe 1997 77.1 5134406 23724.0
Finland Europe 2002 78.4 5193039 28204.6
Finland Europe 2007 79.3 5238460 33207.1
France Europe 1952 67.4 42459667 7029.8
France Europe 1957 68.9 44310863 8662.8
France Europe 1962 70.5 47124000 10560.5
France Europe 1967 71.6 49569000 12999.9
France Europe 1972 72.4 51732000 16107.2
France Europe 1977 73.8 53165019 18292.6
France Europe 1982 74.9 54433565 20293.9
France Europe 1987 76.3 55630100 22066.4
France Europe 1992 77.5 57374179 24703.8
France Europe 1997 78.6 58623428 25889.8
France Europe 2002 79.6 59925035 28926.0
France Europe 2007 80.7 61083916 30470.0
Gabon Africa 1952 37.0 420702 4293.5
Gabon Africa 1957 39.0 434904 4976.2
Gabon Africa 1962 40.5 455661 6631.5
Gabon Africa 1967 44.6 489004 8358.8
Gabon Africa 1972 48.7 537977 11401.9
Gabon Africa 1977 52.8 706367 21745.6
Gabon Africa 1982 56.6 753874 15113.4
Gabon Africa 1987 60.2 880397 11864.4
Gabon Africa 1992 61.4 985739 13522.2
Gabon Africa 1997 60.5 1126189 14722.8
Gabon Africa 2002 56.8 1299304 12521.7
Gabon Africa 2007 56.7 1454867 13206.5
Gambia Africa 1952 30.0 284320 485.2
Gambia Africa 1957 32.1 323150 520.9
Gambia Africa 1962 33.9 374020 599.7
Gambia Africa 1967 35.9 439593 734.8
Gambia Africa 1972 38.3 517101 756.1
Gambia Africa 1977 41.8 608274 884.8
Gambia Africa 1982 45.6 715523 835.8
Gambia Africa 1987 49.3 848406 611.7
Gambia Africa 1992 52.6 1025384 665.6
Gambia Africa 1997 55.9 1235767 653.7
Gambia Africa 2002 58.0 1457766 660.6
Gambia Africa 2007 59.4 1688359 752.7
Germany Europe 1952 67.5 69145952 7144.1
Germany Europe 1957 69.1 71019069 10187.8
Germany Europe 1962 70.3 73739117 12902.5
Germany Europe 1967 70.8 76368453 14745.6
Germany Europe 1972 71.0 78717088 18016.2
Germany Europe 1977 72.5 78160773 20512.9
Germany Europe 1982 73.8 78335266 22031.5
Germany Europe 1987 74.8 77718298 24639.2
Germany Europe 1992 76.1 80597764 26505.3
Germany Europe 1997 77.3 82011073 27788.9
Germany Europe 2002 78.7 82350671 30035.8
Germany Europe 2007 79.4 82400996 32170.4
Ghana Africa 1952 43.1 5581001 911.3
Ghana Africa 1957 44.8 6391288 1043.6
Ghana Africa 1962 46.5 7355248 1190.0
Ghana Africa 1967 48.1 8490213 1125.7
Ghana Africa 1972 49.9 9354120 1178.2
Ghana Africa 1977 51.8 10538093 993.2
Ghana Africa 1982 53.7 11400338 876.0
Ghana Africa 1987 55.7 14168101 847.0
Ghana Africa 1992 57.5 16278738 925.1
Ghana Africa 1997 58.6 18418288 1005.2
Ghana Africa 2002 58.5 20550751 1112.0
Ghana Africa 2007 60.0 22873338 1327.6
Greece Europe 1952 65.9 7733250 3530.7
Greece Europe 1957 67.9 8096218 4916.3
Greece Europe 1962 69.5 8448233 6017.2
Greece Europe 1967 71.0 8716441 8513.1
Greece Europe 1972 72.3 8888628 12724.8
Greece Europe 1977 73.7 9308479 14195.5
Greece Europe 1982 75.2 9786480 15268.4
Greece Europe 1987 76.7 9974490 16120.5
Greece Europe 1992 77.0 10325429 17541.5
Greece Europe 1997 77.9 10502372 18747.7
Greece Europe 2002 78.3 10603863 22514.3
Greece Europe 2007 79.5 10706290 27538.4
Guatemala Americas 1952 42.0 3146381 2428.2
Guatemala Americas 1957 44.1 3640876 2617.2
Guatemala Americas 1962 47.0 4208858 2750.4
Guatemala Americas 1967 50.0 4690773 3242.5
Guatemala Americas 1972 53.7 5149581 4031.4
Guatemala Americas 1977 56.0 5703430 4880.0
Guatemala Americas 1982 58.1 6395630 4820.5
Guatemala Americas 1987 60.8 7326406 4246.5
Guatemala Americas 1992 63.4 8486949 4439.5
Guatemala Americas 1997 66.3 9803875 4684.3
Guatemala Americas 2002 69.0 11178650 4858.3
Guatemala Americas 2007 70.3 12572928 5186.1
Guinea Africa 1952 33.6 2664249 510.2
Guinea Africa 1957 34.6 2876726 576.3
Guinea Africa 1962 35.8 3140003 686.4
Guinea Africa 1967 37.2 3451418 708.8
Guinea Africa 1972 38.8 3811387 741.7
Guinea Africa 1977 40.8 4227026 874.7
Guinea Africa 1982 42.9 4710497 857.3
Guinea Africa 1987 45.6 5650262 805.6
Guinea Africa 1992 48.6 6990574 794.3
Guinea Africa 1997 51.5 8048834 869.4
Guinea Africa 2002 53.7 8807818 945.6
Guinea Africa 2007 56.0 9947814 942.7
Guinea-Bissau Africa 1952 32.5 580653 299.9
Guinea-Bissau Africa 1957 33.5 601095 431.8
Guinea-Bissau Africa 1962 34.5 627820 522.0
Guinea-Bissau Africa 1967 35.5 601287 715.6
Guinea-Bissau Africa 1972 36.5 625361 820.2
Guinea-Bissau Africa 1977 37.5 745228 764.7
Guinea-Bissau Africa 1982 39.3 825987 838.1
Guinea-Bissau Africa 1987 41.2 927524 736.4
Guinea-Bissau Africa 1992 43.3 1050938 745.5
Guinea-Bissau Africa 1997 44.9 1193708 796.7
Guinea-Bissau Africa 2002 45.5 1332459 575.7
Guinea-Bissau Africa 2007 46.4 1472041 579.2
Haiti Americas 1952 37.6 3201488 1840.4
Haiti Americas 1957 40.7 3507701 1726.9
Haiti Americas 1962 43.6 3880130 1796.6
Haiti Americas 1967 46.2 4318137 1452.1
Haiti Americas 1972 48.0 4698301 1654.5
Haiti Americas 1977 49.9 4908554 1874.3
Haiti Americas 1982 51.5 5198399 2011.2
Haiti Americas 1987 53.6 5756203 1823.0
Haiti Americas 1992 55.1 6326682 1456.3
Haiti Americas 1997 56.7 6913545 1341.7
Haiti Americas 2002 58.1 7607651 1270.4
Haiti Americas 2007 60.9 8502814 1201.6
Honduras Americas 1952 41.9 1517453 2194.9
Honduras Americas 1957 44.7 1770390 2220.5
Honduras Americas 1962 48.0 2090162 2291.2
Honduras Americas 1967 50.9 2500689 2538.3
Honduras Americas 1972 53.9 2965146 2529.8
Honduras Americas 1977 57.4 3055235 3203.2
Honduras Americas 1982 60.9 3669448 3121.8
Honduras Americas 1987 64.5 4372203 3023.1
Honduras Americas 1992 66.4 5077347 3081.7
Honduras Americas 1997 67.7 5867957 3160.5
Honduras Americas 2002 68.6 6677328 3099.7
Honduras Americas 2007 70.2 7483763 3548.3
Hong Kong, China Asia 1952 61.0 2125900 3054.4
Hong Kong, China Asia 1957 64.8 2736300 3629.1
Hong Kong, China Asia 1962 67.7 3305200 4692.6
Hong Kong, China Asia 1967 70.0 3722800 6198.0
Hong Kong, China Asia 1972 72.0 4115700 8315.9
Hong Kong, China Asia 1977 73.6 4583700 11186.1
Hong Kong, China Asia 1982 75.4 5264500 14560.5
Hong Kong, China Asia 1987 76.2 5584510 20038.5
Hong Kong, China Asia 1992 77.6 5829696 24757.6
Hong Kong, China Asia 1997 80.0 6495918 28377.6
Hong Kong, China Asia 2002 81.5 6762476 30209.0
Hong Kong, China Asia 2007 82.2 6980412 39725.0
Hungary Europe 1952 64.0 9504000 5263.7
Hungary Europe 1957 66.4 9839000 6040.2
Hungary Europe 1962 68.0 10063000 7550.4
Hungary Europe 1967 69.5 10223422 9326.6
Hungary Europe 1972 69.8 10394091 10168.7
Hungary Europe 1977 70.0 10637171 11674.8
Hungary Europe 1982 69.4 10705535 12546.0
Hungary Europe 1987 69.6 10612740 12986.5
Hungary Europe 1992 69.2 10348684 10535.6
Hungary Europe 1997 71.0 10244684 11712.8
Hungary Europe 2002 72.6 10083313 14843.9
Hungary Europe 2007 73.3 9956108 18008.9
Iceland Europe 1952 72.5 147962 7267.7
Iceland Europe 1957 73.5 165110 9244.0
Iceland Europe 1962 73.7 182053 10350.2
Iceland Europe 1967 73.7 198676 13319.9
Iceland Europe 1972 74.5 209275 15798.1
Iceland Europe 1977 76.1 221823 19655.0
Iceland Europe 1982 77.0 233997 23269.6
Iceland Europe 1987 77.2 244676 26923.2
Iceland Europe 1992 78.8 259012 25144.4
Iceland Europe 1997 79.0 271192 28061.1
Iceland Europe 2002 80.5 288030 31163.2
Iceland Europe 2007 81.8 301931 36180.8
India Asia 1952 37.4 372000000 546.6
India Asia 1957 40.2 409000000 590.1
India Asia 1962 43.6 454000000 658.3
India Asia 1967 47.2 506000000 700.8
India Asia 1972 50.7 567000000 724.0
India Asia 1977 54.2 634000000 813.3
India Asia 1982 56.6 708000000 855.7
India Asia 1987 58.6 788000000 976.5
India Asia 1992 60.2 872000000 1164.4
India Asia 1997 61.8 959000000 1458.8
India Asia 2002 62.9 1034172547 1746.8
India Asia 2007 64.7 1110396331 2452.2
Indonesia Asia 1952 37.5 82052000 749.7
Indonesia Asia 1957 39.9 90124000 858.9
Indonesia Asia 1962 42.5 99028000 849.3
Indonesia Asia 1967 46.0 109343000 762.4
Indonesia Asia 1972 49.2 121282000 1111.1
Indonesia Asia 1977 52.7 136725000 1382.7
Indonesia Asia 1982 56.2 153343000 1516.9
Indonesia Asia 1987 60.1 169276000 1748.4
Indonesia Asia 1992 62.7 184816000 2383.1
Indonesia Asia 1997 66.0 199278000 3119.3
Indonesia Asia 2002 68.6 211060000 2873.9
Indonesia Asia 2007 70.7 223547000 3540.7
Iran Asia 1952 44.9 17272000 3035.3
Iran Asia 1957 47.2 19792000 3290.3
Iran Asia 1962 49.3 22874000 4187.3
Iran Asia 1967 52.5 26538000 5906.7
Iran Asia 1972 55.2 30614000 9613.8
Iran Asia 1977 57.7 35480679 11888.6
Iran Asia 1982 59.6 43072751 7608.3
Iran Asia 1987 63.0 51889696 6642.9
Iran Asia 1992 65.7 60397973 7235.7
Iran Asia 1997 68.0 63327987 8263.6
Iran Asia 2002 69.5 66907826 9240.8
Iran Asia 2007 71.0 69453570 11605.7
Iraq Asia 1952 45.3 5441766 4129.8
Iraq Asia 1957 48.4 6248643 6229.3
Iraq Asia 1962 51.5 7240260 8341.7
Iraq Asia 1967 54.5 8519282 8931.5
Iraq Asia 1972 57.0 10061506 9576.0
Iraq Asia 1977 60.4 11882916 14688.2
Iraq Asia 1982 62.0 14173318 14517.9
Iraq Asia 1987 65.0 16543189 11643.6
Iraq Asia 1992 59.5 17861905 3745.6
Iraq Asia 1997 58.8 20775703 3076.2
Iraq Asia 2002 57.0 24001816 4390.7
Iraq Asia 2007 59.5 27499638 4471.1
Ireland Europe 1952 66.9 2952156 5210.3
Ireland Europe 1957 68.9 2878220 5599.1
Ireland Europe 1962 70.3 2830000 6631.6
Ireland Europe 1967 71.1 2900100 7655.6
Ireland Europe 1972 71.3 3024400 9530.8
Ireland Europe 1977 72.0 3271900 11151.0
Ireland Europe 1982 73.1 3480000 12618.3
Ireland Europe 1987 74.4 3539900 13872.9
Ireland Europe 1992 75.5 3557761 17558.8
Ireland Europe 1997 76.1 3667233 24521.9
Ireland Europe 2002 77.8 3879155 34077.0
Ireland Europe 2007 78.9 4109086 40676.0
Israel Asia 1952 65.4 1620914 4086.5
Israel Asia 1957 67.8 1944401 5385.3
Israel Asia 1962 69.4 2310904 7105.6
Israel Asia 1967 70.8 2693585 8393.7
Israel Asia 1972 71.6 3095893 12786.9
Israel Asia 1977 73.1 3495918 13306.6
Israel Asia 1982 74.4 3858421 15367.0
Israel Asia 1987 75.6 4203148 17122.5
Israel Asia 1992 76.9 4936550 18051.5
Israel Asia 1997 78.3 5531387 20896.6
Israel Asia 2002 79.7 6029529 21905.6
Israel Asia 2007 80.7 6426679 25523.3
Italy Europe 1952 65.9 47666000 4931.4
Italy Europe 1957 67.8 49182000 6248.7
Italy Europe 1962 69.2 50843200 8243.6
Italy Europe 1967 71.1 52667100 10022.4
Italy Europe 1972 72.2 54365564 12269.3
Italy Europe 1977 73.5 56059245 14256.0
Italy Europe 1982 75.0 56535636 16537.5
Italy Europe 1987 76.4 56729703 19207.2
Italy Europe 1992 77.4 56840847 22013.6
Italy Europe 1997 78.8 57479469 24675.0
Italy Europe 2002 80.2 57926999 27968.1
Italy Europe 2007 80.5 58147733 28569.7
Jamaica Americas 1952 58.5 1426095 2898.5
Jamaica Americas 1957 62.6 1535090 4756.5
Jamaica Americas 1962 65.6 1665128 5246.1
Jamaica Americas 1967 67.5 1861096 6124.7
Jamaica Americas 1972 69.0 1997616 7433.9
Jamaica Americas 1977 70.1 2156814 6650.2
Jamaica Americas 1982 71.2 2298309 6068.1
Jamaica Americas 1987 71.8 2326606 6351.2
Jamaica Americas 1992 71.8 2378618 7404.9
Jamaica Americas 1997 72.3 2531311 7121.9
Jamaica Americas 2002 72.0 2664659 6994.8
Jamaica Americas 2007 72.6 2780132 7320.9
Japan Asia 1952 63.0 86459025 3217.0
Japan Asia 1957 65.5 91563009 4317.7
Japan Asia 1962 68.7 95831757 6576.6
Japan Asia 1967 71.4 100825279 9847.8
Japan Asia 1972 73.4 107188273 14778.8
Japan Asia 1977 75.4 113872473 16610.4
Japan Asia 1982 77.1 118454974 19384.1
Japan Asia 1987 78.7 122091325 22375.9
Japan Asia 1992 79.4 124329269 26824.9
Japan Asia 1997 80.7 125956499 28816.6
Japan Asia 2002 82.0 127065841 28604.6
Japan Asia 2007 82.6 127467972 31656.1
Jordan Asia 1952 43.2 607914 1546.9
Jordan Asia 1957 45.7 746559 1886.1
Jordan Asia 1962 48.1 933559 2348.0
Jordan Asia 1967 51.6 1255058 2741.8
Jordan Asia 1972 56.5 1613551 2110.9
Jordan Asia 1977 61.1 1937652 2852.4
Jordan Asia 1982 63.7 2347031 4161.4
Jordan Asia 1987 65.9 2820042 4448.7
Jordan Asia 1992 68.0 3867409 3431.6
Jordan Asia 1997 69.8 4526235 3645.4
Jordan Asia 2002 71.3 5307470 3844.9
Jordan Asia 2007 72.5 6053193 4519.5
Kenya Africa 1952 42.3 6464046 853.5
Kenya Africa 1957 44.7 7454779 944.4
Kenya Africa 1962 47.9 8678557 897.0
Kenya Africa 1967 50.7 10191512 1056.7
Kenya Africa 1972 53.6 12044785 1222.4
Kenya Africa 1977 56.2 14500404 1267.6
Kenya Africa 1982 58.8 17661452 1348.2
Kenya Africa 1987 59.3 21198082 1361.9
Kenya Africa 1992 59.3 25020539 1341.9
Kenya Africa 1997 54.4 28263827 1360.5
Kenya Africa 2002 51.0 31386842 1287.5
Kenya Africa 2007 54.1 35610177 1463.2
Korea, Dem. Rep. Asia 1952 50.1 8865488 1088.3
Korea, Dem. Rep. Asia 1957 54.1 9411381 1571.1
Korea, Dem. Rep. Asia 1962 56.7 10917494 1621.7
Korea, Dem. Rep. Asia 1967 59.9 12617009 2143.5
Korea, Dem. Rep. Asia 1972 64.0 14781241 3701.6
Korea, Dem. Rep. Asia 1977 67.2 16325320 4106.3
Korea, Dem. Rep. Asia 1982 69.1 17647518 4106.5
Korea, Dem. Rep. Asia 1987 70.6 19067554 4106.5
Korea, Dem. Rep. Asia 1992 70.0 20711375 3726.1
Korea, Dem. Rep. Asia 1997 67.7 21585105 1690.8
Korea, Dem. Rep. Asia 2002 66.7 22215365 1646.8
Korea, Dem. Rep. Asia 2007 67.3 23301725 1593.1
Korea, Rep. Asia 1952 47.5 20947571 1030.6
Korea, Rep. Asia 1957 52.7 22611552 1487.6
Korea, Rep. Asia 1962 55.3 26420307 1536.3
Korea, Rep. Asia 1967 57.7 30131000 2029.2
Korea, Rep. Asia 1972 62.6 33505000 3030.9
Korea, Rep. Asia 1977 64.8 36436000 4657.2
Korea, Rep. Asia 1982 67.1 39326000 5622.9
Korea, Rep. Asia 1987 69.8 41622000 8533.1
Korea, Rep. Asia 1992 72.2 43805450 12104.3
Korea, Rep. Asia 1997 74.6 46173816 15993.5
Korea, Rep. Asia 2002 77.0 47969150 19234.0
Korea, Rep. Asia 2007 78.6 49044790 23348.1
Kuwait Asia 1952 55.6 160000 108382.4
Kuwait Asia 1957 58.0 212846 113523.1
Kuwait Asia 1962 60.5 358266 95458.1
Kuwait Asia 1967 64.6 575003 80894.9
Kuwait Asia 1972 67.7 841934 109347.9
Kuwait Asia 1977 69.3 1140357 59265.5
Kuwait Asia 1982 71.3 1497494 31354.0
Kuwait Asia 1987 74.2 1891487 28118.4
Kuwait Asia 1992 75.2 1418095 34932.9
Kuwait Asia 1997 76.2 1765345 40300.6
Kuwait Asia 2002 76.9 2111561 35110.1
Kuwait Asia 2007 77.6 2505559 47307.0
Lebanon Asia 1952 55.9 1439529 4834.8
Lebanon Asia 1957 59.5 1647412 6089.8
Lebanon Asia 1962 62.1 1886848 5714.6
Lebanon Asia 1967 63.9 2186894 6007.0
Lebanon Asia 1972 65.4 2680018 7486.4
Lebanon Asia 1977 66.1 3115787 8659.7
Lebanon Asia 1982 67.0 3086876 7640.5
Lebanon Asia 1987 67.9 3089353 5377.1
Lebanon Asia 1992 69.3 3219994 6890.8
Lebanon Asia 1997 70.3 3430388 8755.0
Lebanon Asia 2002 71.0 3677780 9313.9
Lebanon Asia 2007 72.0 3921278 10461.1
Lesotho Africa 1952 42.1 748747 298.8
Lesotho Africa 1957 45.0 813338 336.0
Lesotho Africa 1962 47.7 893143 411.8
Lesotho Africa 1967 48.5 996380 498.6
Lesotho Africa 1972 49.8 1116779 496.6
Lesotho Africa 1977 52.2 1251524 745.4
Lesotho Africa 1982 55.1 1411807 797.3
Lesotho Africa 1987 57.2 1599200 774.0
Lesotho Africa 1992 59.7 1803195 977.5
Lesotho Africa 1997 55.6 1982823 1186.1
Lesotho Africa 2002 44.6 2046772 1275.2
Lesotho Africa 2007 42.6 2012649 1569.3
Liberia Africa 1952 38.5 863308 575.6
Liberia Africa 1957 39.5 975950 621.0
Liberia Africa 1962 40.5 1112796 634.2
Liberia Africa 1967 41.5 1279406 713.6
Liberia Africa 1972 42.6 1482628 803.0
Liberia Africa 1977 43.8 1703617 640.3
Liberia Africa 1982 44.9 1956875 572.2
Liberia Africa 1987 46.0 2269414 506.1
Liberia Africa 1992 40.8 1912974 636.6
Liberia Africa 1997 42.2 2200725 609.2
Liberia Africa 2002 43.8 2814651 531.5
Liberia Africa 2007 45.7 3193942 414.5
Libya Africa 1952 42.7 1019729 2387.5
Libya Africa 1957 45.3 1201578 3448.3
Libya Africa 1962 47.8 1441863 6757.0
Libya Africa 1967 50.2 1759224 18772.8
Libya Africa 1972 52.8 2183877 21011.5
Libya Africa 1977 57.4 2721783 21951.2
Libya Africa 1982 62.2 3344074 17364.3
Libya Africa 1987 66.2 3799845 11770.6
Libya Africa 1992 68.8 4364501 9640.1
Libya Africa 1997 71.6 4759670 9467.4
Libya Africa 2002 72.7 5368585 9534.7
Libya Africa 2007 74.0 6036914 12057.5
Madagascar Africa 1952 36.7 4762912 1443.0
Madagascar Africa 1957 38.9 5181679 1589.2
Madagascar Africa 1962 40.8 5703324 1643.4
Madagascar Africa 1967 42.9 6334556 1634.0
Madagascar Africa 1972 44.9 7082430 1748.6
Madagascar Africa 1977 46.9 8007166 1544.2
Madagascar Africa 1982 49.0 9171477 1302.9
Madagascar Africa 1987 49.4 10568642 1155.4
Madagascar Africa 1992 52.2 12210395 1040.7
Madagascar Africa 1997 55.0 14165114 986.3
Madagascar Africa 2002 57.3 16473477 894.6
Madagascar Africa 2007 59.4 19167654 1044.8
Malawi Africa 1952 36.3 2917802 369.2
Malawi Africa 1957 37.2 3221238 416.4
Malawi Africa 1962 38.4 3628608 427.9
Malawi Africa 1967 39.5 4147252 495.5
Malawi Africa 1972 41.8 4730997 584.6
Malawi Africa 1977 43.8 5637246 663.2
Malawi Africa 1982 45.6 6502825 632.8
Malawi Africa 1987 47.5 7824747 635.5
Malawi Africa 1992 49.4 10014249 563.2
Malawi Africa 1997 47.5 10419991 692.3
Malawi Africa 2002 45.0 11824495 665.4
Malawi Africa 2007 48.3 13327079 759.3
Malaysia Asia 1952 48.5 6748378 1831.1
Malaysia Asia 1957 52.1 7739235 1810.1
Malaysia Asia 1962 55.7 8906385 2036.9
Malaysia Asia 1967 59.4 10154878 2277.7
Malaysia Asia 1972 63.0 11441462 2849.1
Malaysia Asia 1977 65.3 12845381 3827.9
Malaysia Asia 1982 68.0 14441916 4920.4
Malaysia Asia 1987 69.5 16331785 5249.8
Malaysia Asia 1992 70.7 18319502 7277.9
Malaysia Asia 1997 71.9 20476091 10132.9
Malaysia Asia 2002 73.0 22662365 10207.0
Malaysia Asia 2007 74.2 24821286 12451.7
Mali Africa 1952 33.7 3838168 452.3
Mali Africa 1957 35.3 4241884 490.4
Mali Africa 1962 36.9 4690372 496.2
Mali Africa 1967 38.5 5212416 545.0
Mali Africa 1972 40.0 5828158 581.4
Mali Africa 1977 41.7 6491649 686.4
Mali Africa 1982 43.9 6998256 618.0
Mali Africa 1987 46.4 7634008 684.2
Mali Africa 1992 48.4 8416215 739.0
Mali Africa 1997 49.9 9384984 790.3
Mali Africa 2002 51.8 10580176 951.4
Mali Africa 2007 54.5 12031795 1042.6
Mauritania Africa 1952 40.5 1022556 743.1
Mauritania Africa 1957 42.3 1076852 846.1
Mauritania Africa 1962 44.2 1146757 1055.9
Mauritania Africa 1967 46.3 1230542 1421.1
Mauritania Africa 1972 48.4 1332786 1586.9
Mauritania Africa 1977 50.9 1456688 1497.5
Mauritania Africa 1982 53.6 1622136 1481.2
Mauritania Africa 1987 56.1 1841240 1421.6
Mauritania Africa 1992 58.3 2119465 1361.4
Mauritania Africa 1997 60.4 2444741 1483.1
Mauritania Africa 2002 62.2 2828858 1579.0
Mauritania Africa 2007 64.2 3270065 1803.2
Mauritius Africa 1952 51.0 516556 1968.0
Mauritius Africa 1957 58.1 609816 2034.0
Mauritius Africa 1962 60.2 701016 2529.1
Mauritius Africa 1967 61.6 789309 2475.4
Mauritius Africa 1972 62.9 851334 2575.5
Mauritius Africa 1977 64.9 913025 3711.0
Mauritius Africa 1982 66.7 992040 3688.0
Mauritius Africa 1987 68.7 1042663 4783.6
Mauritius Africa 1992 69.7 1096202 6058.3
Mauritius Africa 1997 70.7 1149818 7425.7
Mauritius Africa 2002 72.0 1200206 9021.8
Mauritius Africa 2007 72.8 1250882 10957.0
Mexico Americas 1952 50.8 30144317 3478.1
Mexico Americas 1957 55.2 35015548 4131.5
Mexico Americas 1962 58.3 41121485 4581.6
Mexico Americas 1967 60.1 47995559 5754.7
Mexico Americas 1972 62.4 55984294 6809.4
Mexico Americas 1977 65.0 63759976 7674.9
Mexico Americas 1982 67.4 71640904 9611.1
Mexico Americas 1987 69.5 80122492 8688.2
Mexico Americas 1992 71.5 88111030 9472.4
Mexico Americas 1997 73.7 95895146 9767.3
Mexico Americas 2002 74.9 102479927 10742.4
Mexico Americas 2007 76.2 108700891 11977.6
Mongolia Asia 1952 42.2 800663 786.6
Mongolia Asia 1957 45.2 882134 912.7
Mongolia Asia 1962 48.3 1010280 1056.4
Mongolia Asia 1967 51.3 1149500 1226.0
Mongolia Asia 1972 53.8 1320500 1421.7
Mongolia Asia 1977 55.5 1528000 1647.5
Mongolia Asia 1982 57.5 1756032 2000.6
Mongolia Asia 1987 60.2 2015133 2338.0
Mongolia Asia 1992 61.3 2312802 1785.4
Mongolia Asia 1997 63.6 2494803 1902.3
Mongolia Asia 2002 65.0 2674234 2140.7
Mongolia Asia 2007 66.8 2874127 3095.8
Montenegro Europe 1952 59.2 413834 2647.6
Montenegro Europe 1957 61.4 442829 3682.3
Montenegro Europe 1962 63.7 474528 4649.6
Montenegro Europe 1967 67.2 501035 5907.9
Montenegro Europe 1972 70.6 527678 7778.4
Montenegro Europe 1977 73.1 560073 9595.9
Montenegro Europe 1982 74.1 562548 11222.6
Montenegro Europe 1987 74.9 569473 11732.5
Montenegro Europe 1992 75.4 621621 7003.3
Montenegro Europe 1997 75.4 692651 6465.6
Montenegro Europe 2002 74.0 720230 6557.2
Montenegro Europe 2007 74.5 684736 9253.9
Morocco Africa 1952 42.9 9939217 1688.2
Morocco Africa 1957 45.4 11406350 1642.0
Morocco Africa 1962 47.9 13056604 1566.4
Morocco Africa 1967 50.3 14770296 1711.0
Morocco Africa 1972 52.9 16660670 1930.2
Morocco Africa 1977 55.7 18396941 2370.6
Morocco Africa 1982 59.6 20198730 2702.6
Morocco Africa 1987 62.7 22987397 2755.0
Morocco Africa 1992 65.4 25798239 2948.0
Morocco Africa 1997 67.7 28529501 2982.1
Morocco Africa 2002 69.6 31167783 3258.5
Morocco Africa 2007 71.2 33757175 3820.2
Mozambique Africa 1952 31.3 6446316 468.5
Mozambique Africa 1957 33.8 7038035 495.6
Mozambique Africa 1962 36.2 7788944 556.7
Mozambique Africa 1967 38.1 8680909 566.7
Mozambique Africa 1972 40.3 9809596 724.9
Mozambique Africa 1977 42.5 11127868 502.3
Mozambique Africa 1982 42.8 12587223 462.2
Mozambique Africa 1987 42.9 12891952 389.9
Mozambique Africa 1992 44.3 13160731 410.9
Mozambique Africa 1997 46.3 16603334 472.3
Mozambique Africa 2002 44.0 18473780 633.6
Mozambique Africa 2007 42.1 19951656 823.7
Myanmar Asia 1952 36.3 20092996 331.0
Myanmar Asia 1957 41.9 21731844 350.0
Myanmar Asia 1962 45.1 23634436 388.0
Myanmar Asia 1967 49.4 25870271 349.0
Myanmar Asia 1972 53.1 28466390 357.0
Myanmar Asia 1977 56.1 31528087 371.0
Myanmar Asia 1982 58.1 34680442 424.0
Myanmar Asia 1987 58.3 38028578 385.0
Myanmar Asia 1992 59.3 40546538 347.0
Myanmar Asia 1997 60.3 43247867 415.0
Myanmar Asia 2002 59.9 45598081 611.0
Myanmar Asia 2007 62.1 47761980 944.0
Namibia Africa 1952 41.7 485831 2423.8
Namibia Africa 1957 45.2 548080 2621.4
Namibia Africa 1962 48.4 621392 3173.2
Namibia Africa 1967 51.2 706640 3793.7
Namibia Africa 1972 53.9 821782 3746.1
Namibia Africa 1977 56.4 977026 3876.5
Namibia Africa 1982 59.0 1099010 4191.1
Namibia Africa 1987 60.8 1278184 3693.7
Namibia Africa 1992 62.0 1554253 3804.5
Namibia Africa 1997 58.9 1774766 3899.5
Namibia Africa 2002 51.5 1972153 4072.3
Namibia Africa 2007 52.9 2055080 4811.1
Nepal Asia 1952 36.2 9182536 545.9
Nepal Asia 1957 37.7 9682338 597.9
Nepal Asia 1962 39.4 10332057 652.4
Nepal Asia 1967 41.5 11261690 676.4
Nepal Asia 1972 44.0 12412593 674.8
Nepal Asia 1977 46.7 13933198 694.1
Nepal Asia 1982 49.6 15796314 718.4
Nepal Asia 1987 52.5 17917180 775.6
Nepal Asia 1992 55.7 20326209 897.7
Nepal Asia 1997 59.4 23001113 1010.9
Nepal Asia 2002 61.3 25873917 1057.2
Nepal Asia 2007 63.8 28901790 1091.4
Netherlands Europe 1952 72.1 10381988 8941.6
Netherlands Europe 1957 73.0 11026383 11276.2
Netherlands Europe 1962 73.2 11805689 12790.8
Netherlands Europe 1967 73.8 12596822 15363.3
Netherlands Europe 1972 73.8 13329874 18794.7
Netherlands Europe 1977 75.2 13852989 21209.1
Netherlands Europe 1982 76.0 14310401 21399.5
Netherlands Europe 1987 76.8 14665278 23651.3
Netherlands Europe 1992 77.4 15174244 26790.9
Netherlands Europe 1997 78.0 15604464 30246.1
Netherlands Europe 2002 78.5 16122830 33724.8
Netherlands Europe 2007 79.8 16570613 36797.9
New Zealand Oceania 1952 69.4 1994794 10556.6
New Zealand Oceania 1957 70.3 2229407 12247.4
New Zealand Oceania 1962 71.2 2488550 13175.7
New Zealand Oceania 1967 71.5 2728150 14463.9
New Zealand Oceania 1972 71.9 2929100 16046.0
New Zealand Oceania 1977 72.2 3164900 16233.7
New Zealand Oceania 1982 73.8 3210650 17632.4
New Zealand Oceania 1987 74.3 3317166 19007.2
New Zealand Oceania 1992 76.3 3437674 18363.3
New Zealand Oceania 1997 77.6 3676187 21050.4
New Zealand Oceania 2002 79.1 3908037 23189.8
New Zealand Oceania 2007 80.2 4115771 25185.0
Nicaragua Americas 1952 42.3 1165790 3112.4
Nicaragua Americas 1957 45.4 1358828 3457.4
Nicaragua Americas 1962 48.6 1590597 3634.4
Nicaragua Americas 1967 51.9 1865490 4643.4
Nicaragua Americas 1972 55.2 2182908 4688.6
Nicaragua Americas 1977 57.5 2554598 5486.4
Nicaragua Americas 1982 59.3 2979423 3470.3
Nicaragua Americas 1987 62.0 3344353 2956.0
Nicaragua Americas 1992 65.8 4017939 2170.2
Nicaragua Americas 1997 68.4 4609572 2253.0
Nicaragua Americas 2002 70.8 5146848 2474.5
Nicaragua Americas 2007 72.9 5675356 2749.3
Niger Africa 1952 37.4 3379468 761.9
Niger Africa 1957 38.6 3692184 835.5
Niger Africa 1962 39.5 4076008 997.8
Niger Africa 1967 40.1 4534062 1054.4
Niger Africa 1972 40.5 5060262 954.2
Niger Africa 1977 41.3 5682086 808.9
Niger Africa 1982 42.6 6437188 909.7
Niger Africa 1987 44.6 7332638 668.3
Niger Africa 1992 47.4 8392818 581.2
Niger Africa 1997 51.3 9666252 580.3
Niger Africa 2002 54.5 11140655 601.1
Niger Africa 2007 56.9 12894865 619.7
Nigeria Africa 1952 36.3 33119096 1077.3
Nigeria Africa 1957 37.8 37173340 1100.6
Nigeria Africa 1962 39.4 41871351 1150.9
Nigeria Africa 1967 41.0 47287752 1014.5
Nigeria Africa 1972 42.8 53740085 1698.4
Nigeria Africa 1977 44.5 62209173 1982.0
Nigeria Africa 1982 45.8 73039376 1577.0
Nigeria Africa 1987 46.9 81551520 1385.0
Nigeria Africa 1992 47.5 93364244 1619.8
Nigeria Africa 1997 47.5 106207839 1624.9
Nigeria Africa 2002 46.6 119901274 1615.3
Nigeria Africa 2007 46.9 135031164 2014.0
Norway Europe 1952 72.7 3327728 10095.4
Norway Europe 1957 73.4 3491938 11654.0
Norway Europe 1962 73.5 3638919 13450.4
Norway Europe 1967 74.1 3786019 16361.9
Norway Europe 1972 74.3 3933004 18965.1
Norway Europe 1977 75.4 4043205 23311.3
Norway Europe 1982 76.0 4114787 26298.6
Norway Europe 1987 75.9 4186147 31541.0
Norway Europe 1992 77.3 4286357 33965.7
Norway Europe 1997 78.3 4405672 41283.2
Norway Europe 2002 79.0 4535591 44684.0
Norway Europe 2007 80.2 4627926 49357.2
Oman Asia 1952 37.6 507833 1828.2
Oman Asia 1957 40.1 561977 2242.7
Oman Asia 1962 43.2 628164 2924.6
Oman Asia 1967 47.0 714775 4720.9
Oman Asia 1972 52.1 829050 10618.0
Oman Asia 1977 57.4 1004533 11848.3
Oman Asia 1982 62.7 1301048 12954.8
Oman Asia 1987 67.7 1593882 18115.2
Oman Asia 1992 71.2 1915208 18616.7
Oman Asia 1997 72.5 2283635 19702.1
Oman Asia 2002 74.2 2713462 19774.8
Oman Asia 2007 75.6 3204897 22316.2
Pakistan Asia 1952 43.4 41346560 684.6
Pakistan Asia 1957 45.6 46679944 747.1
Pakistan Asia 1962 47.7 53100671 803.3
Pakistan Asia 1967 49.8 60641899 942.4
Pakistan Asia 1972 51.9 69325921 1049.9
Pakistan Asia 1977 54.0 78152686 1175.9
Pakistan Asia 1982 56.2 91462088 1443.4
Pakistan Asia 1987 58.2 105186881 1704.7
Pakistan Asia 1992 60.8 120065004 1971.8
Pakistan Asia 1997 61.8 135564834 2049.4
Pakistan Asia 2002 63.6 153403524 2092.7
Pakistan Asia 2007 65.5 169270617 2605.9
Panama Americas 1952 55.2 940080 2480.4
Panama Americas 1957 59.2 1063506 2961.8
Panama Americas 1962 61.8 1215725 3536.5
Panama Americas 1967 64.1 1405486 4421.0
Panama Americas 1972 66.2 1616384 5364.2
Panama Americas 1977 68.7 1839782 5351.9
Panama Americas 1982 70.5 2036305 7009.6
Panama Americas 1987 71.5 2253639 7034.8
Panama Americas 1992 72.5 2484997 6618.7
Panama Americas 1997 73.7 2734531 7113.7
Panama Americas 2002 74.7 2990875 7356.0
Panama Americas 2007 75.5 3242173 9809.2
Paraguay Americas 1952 62.6 1555876 1952.3
Paraguay Americas 1957 63.2 1770902 2046.2
Paraguay Americas 1962 64.4 2009813 2148.0
Paraguay Americas 1967 65.0 2287985 2299.4
Paraguay Americas 1972 65.8 2614104 2523.3
Paraguay Americas 1977 66.4 2984494 3248.4
Paraguay Americas 1982 66.9 3366439 4258.5
Paraguay Americas 1987 67.4 3886512 3998.9
Paraguay Americas 1992 68.2 4483945 4196.4
Paraguay Americas 1997 69.4 5154123 4247.4
Paraguay Americas 2002 70.8 5884491 3783.7
Paraguay Americas 2007 71.8 6667147 4172.8
Peru Americas 1952 43.9 8025700 3758.5
Peru Americas 1957 46.3 9146100 4245.3
Peru Americas 1962 49.1 10516500 4957.0
Peru Americas 1967 51.4 12132200 5788.1
Peru Americas 1972 55.4 13954700 5937.8
Peru Americas 1977 58.4 15990099 6281.3
Peru Americas 1982 61.4 18125129 6434.5
Peru Americas 1987 64.1 20195924 6360.9
Peru Americas 1992 66.5 22430449 4446.4
Peru Americas 1997 68.4 24748122 5838.3
Peru Americas 2002 69.9 26769436 5909.0
Peru Americas 2007 71.4 28674757 7408.9
Philippines Asia 1952 47.8 22438691 1272.9
Philippines Asia 1957 51.3 26072194 1547.9
Philippines Asia 1962 54.8 30325264 1649.6
Philippines Asia 1967 56.4 35356600 1814.1
Philippines Asia 1972 58.1 40850141 1989.4
Philippines Asia 1977 60.1 46850962 2373.2
Philippines Asia 1982 62.1 53456774 2603.3
Philippines Asia 1987 64.2 60017788 2189.6
Philippines Asia 1992 66.5 67185766 2279.3
Philippines Asia 1997 68.6 75012988 2536.5
Philippines Asia 2002 70.3 82995088 2650.9
Philippines Asia 2007 71.7 91077287 3190.5
Poland Europe 1952 61.3 25730551 4029.3
Poland Europe 1957 65.8 28235346 4734.3
Poland Europe 1962 67.6 30329617 5338.8
Poland Europe 1967 69.6 31785378 6557.2
Poland Europe 1972 70.8 33039545 8006.5
Poland Europe 1977 70.7 34621254 9508.1
Poland Europe 1982 71.3 36227381 8451.5
Poland Europe 1987 71.0 37740710 9082.4
Poland Europe 1992 71.0 38370697 7738.9
Poland Europe 1997 72.8 38654957 10159.6
Poland Europe 2002 74.7 38625976 12002.2
Poland Europe 2007 75.6 38518241 15389.9
Portugal Europe 1952 59.8 8526050 3068.3
Portugal Europe 1957 61.5 8817650 3774.6
Portugal Europe 1962 64.4 9019800 4728.0
Portugal Europe 1967 66.6 9103000 6361.5
Portugal Europe 1972 69.3 8970450 9022.2
Portugal Europe 1977 70.4 9662600 10172.5
Portugal Europe 1982 72.8 9859650 11753.8
Portugal Europe 1987 74.1 9915289 13039.3
Portugal Europe 1992 74.9 9927680 16207.3
Portugal Europe 1997 76.0 10156415 17641.0
Portugal Europe 2002 77.3 10433867 19970.9
Portugal Europe 2007 78.1 10642836 20509.6
Puerto Rico Americas 1952 64.3 2227000 3082.0
Puerto Rico Americas 1957 68.5 2260000 3907.2
Puerto Rico Americas 1962 69.6 2448046 5108.3
Puerto Rico Americas 1967 71.1 2648961 6929.3
Puerto Rico Americas 1972 72.2 2847132 9123.0
Puerto Rico Americas 1977 73.4 3080828 9770.5
Puerto Rico Americas 1982 73.8 3279001 10331.0
Puerto Rico Americas 1987 74.6 3444468 12281.3
Puerto Rico Americas 1992 73.9 3585176 14641.6
Puerto Rico Americas 1997 74.9 3759430 16999.4
Puerto Rico Americas 2002 77.8 3859606 18855.6
Puerto Rico Americas 2007 78.7 3942491 19328.7
Reunion Africa 1952 52.7 257700 2718.9
Reunion Africa 1957 55.1 308700 2769.5
Reunion Africa 1962 57.7 358900 3173.7
Reunion Africa 1967 60.5 414024 4021.2
Reunion Africa 1972 64.3 461633 5047.7
Reunion Africa 1977 67.1 492095 4319.8
Reunion Africa 1982 69.9 517810 5267.2
Reunion Africa 1987 71.9 562035 5303.4
Reunion Africa 1992 73.6 622191 6101.3
Reunion Africa 1997 74.8 684810 6071.9
Reunion Africa 2002 75.7 743981 6316.2
Reunion Africa 2007 76.4 798094 7670.1
Romania Europe 1952 61.0 16630000 3144.6
Romania Europe 1957 64.1 17829327 3943.4
Romania Europe 1962 66.8 18680721 4735.0
Romania Europe 1967 66.8 19284814 6470.9
Romania Europe 1972 69.2 20662648 8011.4
Romania Europe 1977 69.5 21658597 9356.4
Romania Europe 1982 69.7 22356726 9605.3
Romania Europe 1987 69.5 22686371 9696.3
Romania Europe 1992 69.4 22797027 6598.4
Romania Europe 1997 69.7 22562458 7346.5
Romania Europe 2002 71.3 22404337 7885.4
Romania Europe 2007 72.5 22276056 10808.5
Rwanda Africa 1952 40.0 2534927 493.3
Rwanda Africa 1957 41.5 2822082 540.3
Rwanda Africa 1962 43.0 3051242 597.5
Rwanda Africa 1967 44.1 3451079 511.0
Rwanda Africa 1972 44.6 3992121 590.6
Rwanda Africa 1977 45.0 4657072 670.1
Rwanda Africa 1982 46.2 5507565 881.6
Rwanda Africa 1987 44.0 6349365 848.0
Rwanda Africa 1992 23.6 7290203 737.1
Rwanda Africa 1997 36.1 7212583 589.9
Rwanda Africa 2002 43.4 7852401 785.7
Rwanda Africa 2007 46.2 8860588 863.1
Sao Tome and Principe Africa 1952 46.5 60011 879.6
Sao Tome and Principe Africa 1957 48.9 61325 860.7
Sao Tome and Principe Africa 1962 51.9 65345 1071.6
Sao Tome and Principe Africa 1967 54.4 70787 1384.8
Sao Tome and Principe Africa 1972 56.5 76595 1533.0
Sao Tome and Principe Africa 1977 58.5 86796 1737.6
Sao Tome and Principe Africa 1982 60.4 98593 1890.2
Sao Tome and Principe Africa 1987 61.7 110812 1516.5
Sao Tome and Principe Africa 1992 62.7 125911 1428.8
Sao Tome and Principe Africa 1997 63.3 145608 1339.1
Sao Tome and Principe Africa 2002 64.3 170372 1353.1
Sao Tome and Principe Africa 2007 65.5 199579 1598.4
Saudi Arabia Asia 1952 39.9 4005677 6459.6
Saudi Arabia Asia 1957 42.9 4419650 8157.6
Saudi Arabia Asia 1962 45.9 4943029 11626.4
Saudi Arabia Asia 1967 49.9 5618198 16903.0
Saudi Arabia Asia 1972 53.9 6472756 24837.4
Saudi Arabia Asia 1977 58.7 8128505 34167.8
Saudi Arabia Asia 1982 63.0 11254672 33693.2
Saudi Arabia Asia 1987 66.3 14619745 21198.3
Saudi Arabia Asia 1992 68.8 16945857 24841.6
Saudi Arabia Asia 1997 70.5 21229759 20586.7
Saudi Arabia Asia 2002 71.6 24501530 19014.5
Saudi Arabia Asia 2007 72.8 27601038 21654.8
Senegal Africa 1952 37.3 2755589 1450.4
Senegal Africa 1957 39.3 3054547 1567.7
Senegal Africa 1962 41.5 3430243 1655.0
Senegal Africa 1967 43.6 3965841 1612.4
Senegal Africa 1972 45.8 4588696 1597.7
Senegal Africa 1977 48.9 5260855 1561.8
Senegal Africa 1982 52.4 6147783 1518.5
Senegal Africa 1987 55.8 7171347 1441.7
Senegal Africa 1992 58.2 8307920 1367.9
Senegal Africa 1997 60.2 9535314 1392.4
Senegal Africa 2002 61.6 10870037 1519.6
Senegal Africa 2007 63.1 12267493 1712.5
Serbia Europe 1952 58.0 6860147 3581.5
Serbia Europe 1957 61.7 7271135 4981.1
Serbia Europe 1962 64.5 7616060 6289.6
Serbia Europe 1967 66.9 7971222 7991.7
Serbia Europe 1972 68.7 8313288 10522.1
Serbia Europe 1977 70.3 8686367 12980.7
Serbia Europe 1982 70.2 9032824 15181.1
Serbia Europe 1987 71.2 9230783 15870.9
Serbia Europe 1992 71.7 9826397 9325.1
Serbia Europe 1997 72.2 10336594 7914.3
Serbia Europe 2002 73.2 10111559 7236.1
Serbia Europe 2007 74.0 10150265 9786.5
Sierra Leone Africa 1952 30.3 2143249 879.8
Sierra Leone Africa 1957 31.6 2295678 1004.5
Sierra Leone Africa 1962 32.8 2467895 1116.6
Sierra Leone Africa 1967 34.1 2662190 1206.0
Sierra Leone Africa 1972 35.4 2879013 1353.8
Sierra Leone Africa 1977 36.8 3140897 1348.3
Sierra Leone Africa 1982 38.4 3464522 1465.0
Sierra Leone Africa 1987 40.0 3868905 1294.4
Sierra Leone Africa 1992 38.3 4260884 1068.7
Sierra Leone Africa 1997 39.9 4578212 574.6
Sierra Leone Africa 2002 41.0 5359092 699.5
Sierra Leone Africa 2007 42.6 6144562 862.5
Singapore Asia 1952 60.4 1127000 2315.1
Singapore Asia 1957 63.2 1445929 2843.1
Singapore Asia 1962 65.8 1750200 3674.7
Singapore Asia 1967 67.9 1977600 4977.4
Singapore Asia 1972 69.5 2152400 8597.8
Singapore Asia 1977 70.8 2325300 11210.1
Singapore Asia 1982 71.8 2651869 15169.2
Singapore Asia 1987 73.6 2794552 18861.5
Singapore Asia 1992 75.8 3235865 24769.9
Singapore Asia 1997 77.2 3802309 33519.5
Singapore Asia 2002 78.8 4197776 36023.1
Singapore Asia 2007 80.0 4553009 47143.2
Slovak Republic Europe 1952 64.4 3558137 5074.7
Slovak Republic Europe 1957 67.4 3844277 6093.3
Slovak Republic Europe 1962 70.3 4237384 7481.1
Slovak Republic Europe 1967 71.0 4442238 8412.9
Slovak Republic Europe 1972 70.3 4593433 9674.2
Slovak Republic Europe 1977 70.4 4827803 10922.7
Slovak Republic Europe 1982 70.8 5048043 11348.5
Slovak Republic Europe 1987 71.1 5199318 12037.3
Slovak Republic Europe 1992 71.4 5302888 9498.5
Slovak Republic Europe 1997 72.7 5383010 12126.2
Slovak Republic Europe 2002 73.8 5410052 13638.8
Slovak Republic Europe 2007 74.7 5447502 18678.3
Slovenia Europe 1952 65.6 1489518 4215.0
Slovenia Europe 1957 67.8 1533070 5862.3
Slovenia Europe 1962 69.2 1582962 7402.3
Slovenia Europe 1967 69.2 1646912 9405.5
Slovenia Europe 1972 69.8 1694510 12383.5
Slovenia Europe 1977 71.0 1746919 15277.0
Slovenia Europe 1982 71.1 1861252 17866.7
Slovenia Europe 1987 72.2 1945870 18678.5
Slovenia Europe 1992 73.6 1999210 14214.7
Slovenia Europe 1997 75.1 2011612 17161.1
Slovenia Europe 2002 76.7 2011497 20660.0
Slovenia Europe 2007 77.9 2009245 25768.3
Somalia Africa 1952 33.0 2526994 1135.7
Somalia Africa 1957 35.0 2780415 1258.1
Somalia Africa 1962 37.0 3080153 1369.5
Somalia Africa 1967 39.0 3428839 1284.7
Somalia Africa 1972 41.0 3840161 1254.6
Somalia Africa 1977 42.0 4353666 1451.0
Somalia Africa 1982 43.0 5828892 1176.8
Somalia Africa 1987 44.5 6921858 1093.2
Somalia Africa 1992 39.7 6099799 927.0
Somalia Africa 1997 43.8 6633514 930.6
Somalia Africa 2002 45.9 7753310 882.1
Somalia Africa 2007 48.2 9118773 926.1
South Africa Africa 1952 45.0 14264935 4725.3
South Africa Africa 1957 48.0 16151549 5487.1
South Africa Africa 1962 50.0 18356657 5768.7
South Africa Africa 1967 51.9 20997321 7114.5
South Africa Africa 1972 53.7 23935810 7766.0
South Africa Africa 1977 55.5 27129932 8028.7
South Africa Africa 1982 58.2 31140029 8568.3
South Africa Africa 1987 60.8 35933379 7825.8
South Africa Africa 1992 61.9 39964159 7225.1
South Africa Africa 1997 60.2 42835005 7479.2
South Africa Africa 2002 53.4 44433622 7710.9
South Africa Africa 2007 49.3 43997828 9269.7
Spain Europe 1952 64.9 28549870 3834.0
Spain Europe 1957 66.7 29841614 4564.8
Spain Europe 1962 69.7 31158061 5693.8
Spain Europe 1967 71.4 32850275 7993.5
Spain Europe 1972 73.1 34513161 10638.8
Spain Europe 1977 74.4 36439000 13236.9
Spain Europe 1982 76.3 37983310 13926.2
Spain Europe 1987 76.9 38880702 15765.0
Spain Europe 1992 77.6 39549438 18603.1
Spain Europe 1997 78.8 39855442 20445.3
Spain Europe 2002 79.8 40152517 24835.5
Spain Europe 2007 80.9 40448191 28821.1
Sri Lanka Asia 1952 57.6 7982342 1083.5
Sri Lanka Asia 1957 61.5 9128546 1072.5
Sri Lanka Asia 1962 62.2 10421936 1074.5
Sri Lanka Asia 1967 64.3 11737396 1135.5
Sri Lanka Asia 1972 65.0 13016733 1213.4
Sri Lanka Asia 1977 65.9 14116836 1348.8
Sri Lanka Asia 1982 68.8 15410151 1648.1
Sri Lanka Asia 1987 69.0 16495304 1876.8
Sri Lanka Asia 1992 70.4 17587060 2153.7
Sri Lanka Asia 1997 70.5 18698655 2664.5
Sri Lanka Asia 2002 70.8 19576783 3015.4
Sri Lanka Asia 2007 72.4 20378239 3970.1
Sudan Africa 1952 38.6 8504667 1616.0
Sudan Africa 1957 39.6 9753392 1770.3
Sudan Africa 1962 40.9 11183227 1959.6
Sudan Africa 1967 42.9 12716129 1688.0
Sudan Africa 1972 45.1 14597019 1659.7
Sudan Africa 1977 47.8 17104986 2203.0
Sudan Africa 1982 50.3 20367053 1895.5
Sudan Africa 1987 51.7 24725960 1507.8
Sudan Africa 1992 53.6 28227588 1492.2
Sudan Africa 1997 55.4 32160729 1632.2
Sudan Africa 2002 56.4 37090298 1993.4
Sudan Africa 2007 58.6 42292929 2602.4
Swaziland Africa 1952 41.4 290243 1148.4
Swaziland Africa 1957 43.4 326741 1244.7
Swaziland Africa 1962 45.0 370006 1856.2
Swaziland Africa 1967 46.6 420690 2613.1
Swaziland Africa 1972 49.6 480105 3364.8
Swaziland Africa 1977 52.5 551425 3781.4
Swaziland Africa 1982 55.6 649901 3895.4
Swaziland Africa 1987 57.7 779348 3984.8
Swaziland Africa 1992 58.5 962344 3553.0
Swaziland Africa 1997 54.3 1054486 3876.8
Swaziland Africa 2002 43.9 1130269 4128.1
Swaziland Africa 2007 39.6 1133066 4513.5
Sweden Europe 1952 71.9 7124673 8527.8
Sweden Europe 1957 72.5 7363802 9911.9
Sweden Europe 1962 73.4 7561588 12329.4
Sweden Europe 1967 74.2 7867931 15258.3
Sweden Europe 1972 74.7 8122293 17832.0
Sweden Europe 1977 75.4 8251648 18855.7
Sweden Europe 1982 76.4 8325260 20667.4
Sweden Europe 1987 77.2 8421403 23586.9
Sweden Europe 1992 78.2 8718867 23880.0
Sweden Europe 1997 79.4 8897619 25266.6
Sweden Europe 2002 80.0 8954175 29341.6
Sweden Europe 2007 80.9 9031088 33859.7
Switzerland Europe 1952 69.6 4815000 14734.2
Switzerland Europe 1957 70.6 5126000 17909.5
Switzerland Europe 1962 71.3 5666000 20431.1
Switzerland Europe 1967 72.8 6063000 22966.1
Switzerland Europe 1972 73.8 6401400 27195.1
Switzerland Europe 1977 75.4 6316424 26982.3
Switzerland Europe 1982 76.2 6468126 28397.7
Switzerland Europe 1987 77.4 6649942 30281.7
Switzerland Europe 1992 78.0 6995447 31871.5
Switzerland Europe 1997 79.4 7193761 32135.3
Switzerland Europe 2002 80.6 7361757 34481.0
Switzerland Europe 2007 81.7 7554661 37506.4
Syria Asia 1952 45.9 3661549 1643.5
Syria Asia 1957 48.3 4149908 2117.2
Syria Asia 1962 50.3 4834621 2193.0
Syria Asia 1967 53.7 5680812 1881.9
Syria Asia 1972 57.3 6701172 2571.4
Syria Asia 1977 61.2 7932503 3195.5
Syria Asia 1982 64.6 9410494 3761.8
Syria Asia 1987 67.0 11242847 3116.8
Syria Asia 1992 69.2 13219062 3340.5
Syria Asia 1997 71.5 15081016 4014.2
Syria Asia 2002 73.1 17155814 4090.9
Syria Asia 2007 74.1 19314747 4184.5
Taiwan Asia 1952 58.5 8550362 1206.9
Taiwan Asia 1957 62.4 10164215 1507.9
Taiwan Asia 1962 65.2 11918938 1822.9
Taiwan Asia 1967 67.5 13648692 2643.9
Taiwan Asia 1972 69.4 15226039 4062.5
Taiwan Asia 1977 70.6 16785196 5596.5
Taiwan Asia 1982 72.2 18501390 7426.4
Taiwan Asia 1987 73.4 19757799 11054.6
Taiwan Asia 1992 74.3 20686918 15215.7
Taiwan Asia 1997 75.2 21628605 20206.8
Taiwan Asia 2002 77.0 22454239 23235.4
Taiwan Asia 2007 78.4 23174294 28718.3
Tanzania Africa 1952 41.2 8322925 716.7
Tanzania Africa 1957 43.0 9452826 698.5
Tanzania Africa 1962 44.2 10863958 722.0
Tanzania Africa 1967 45.8 12607312 848.2
Tanzania Africa 1972 47.6 14706593 916.0
Tanzania Africa 1977 49.9 17129565 962.5
Tanzania Africa 1982 50.6 19844382 874.2
Tanzania Africa 1987 51.5 23040630 831.8
Tanzania Africa 1992 50.4 26605473 825.7
Tanzania Africa 1997 48.5 30686889 789.2
Tanzania Africa 2002 49.7 34593779 899.1
Tanzania Africa 2007 52.5 38139640 1107.5
Thailand Asia 1952 50.8 21289402 757.8
Thailand Asia 1957 53.6 25041917 793.6
Thailand Asia 1962 56.1 29263397 1002.2
Thailand Asia 1967 58.3 34024249 1295.5
Thailand Asia 1972 60.4 39276153 1524.4
Thailand Asia 1977 62.5 44148285 1961.2
Thailand Asia 1982 64.6 48827160 2393.2
Thailand Asia 1987 66.1 52910342 2982.7
Thailand Asia 1992 67.3 56667095 4616.9
Thailand Asia 1997 67.5 60216677 5852.6
Thailand Asia 2002 68.6 62806748 5913.2
Thailand Asia 2007 70.6 65068149 7458.4
Togo Africa 1952 38.6 1219113 859.8
Togo Africa 1957 41.2 1357445 925.9
Togo Africa 1962 43.9 1528098 1067.5
Togo Africa 1967 46.8 1735550 1477.6
Togo Africa 1972 49.8 2056351 1649.7
Togo Africa 1977 52.9 2308582 1532.8
Togo Africa 1982 55.5 2644765 1344.6
Togo Africa 1987 56.9 3154264 1202.2
Togo Africa 1992 58.1 3747553 1034.3
Togo Africa 1997 58.4 4320890 982.3
Togo Africa 2002 57.6 4977378 886.2
Togo Africa 2007 58.4 5701579 883.0
Trinidad and Tobago Americas 1952 59.1 662850 3023.3
Trinidad and Tobago Americas 1957 61.8 764900 4100.4
Trinidad and Tobago Americas 1962 64.9 887498 4997.5
Trinidad and Tobago Americas 1967 65.4 960155 5621.4
Trinidad and Tobago Americas 1972 65.9 975199 6619.6
Trinidad and Tobago Americas 1977 68.3 1039009 7899.6
Trinidad and Tobago Americas 1982 68.8 1116479 9119.5
Trinidad and Tobago Americas 1987 69.6 1191336 7388.6
Trinidad and Tobago Americas 1992 69.9 1183669 7371.0
Trinidad and Tobago Americas 1997 69.5 1138101 8792.6
Trinidad and Tobago Americas 2002 69.0 1101832 11460.6
Trinidad and Tobago Americas 2007 69.8 1056608 18008.5
Tunisia Africa 1952 44.6 3647735 1468.5
Tunisia Africa 1957 47.1 3950849 1395.2
Tunisia Africa 1962 49.6 4286552 1660.3
Tunisia Africa 1967 52.1 4786986 1932.4
Tunisia Africa 1972 55.6 5303507 2753.3
Tunisia Africa 1977 59.8 6005061 3120.9
Tunisia Africa 1982 64.0 6734098 3560.2
Tunisia Africa 1987 66.9 7724976 3810.4
Tunisia Africa 1992 70.0 8523077 4332.7
Tunisia Africa 1997 72.0 9231669 4876.8
Tunisia Africa 2002 73.0 9770575 5722.9
Tunisia Africa 2007 73.9 10276158 7092.9
Turkey Europe 1952 43.6 22235677 1969.1
Turkey Europe 1957 48.1 25670939 2218.8
Turkey Europe 1962 52.1 29788695 2322.9
Turkey Europe 1967 54.3 33411317 2826.4
Turkey Europe 1972 57.0 37492953 3450.7
Turkey Europe 1977 59.5 42404033 4269.1
Turkey Europe 1982 61.0 47328791 4241.4
Turkey Europe 1987 63.1 52881328 5089.0
Turkey Europe 1992 66.1 58179144 5678.3
Turkey Europe 1997 68.8 63047647 6601.4
Turkey Europe 2002 70.8 67308928 6508.1
Turkey Europe 2007 71.8 71158647 8458.3
Uganda Africa 1952 40.0 5824797 734.8
Uganda Africa 1957 42.6 6675501 774.4
Uganda Africa 1962 45.3 7688797 767.3
Uganda Africa 1967 48.1 8900294 908.9
Uganda Africa 1972 51.0 10190285 950.7
Uganda Africa 1977 50.4 11457758 843.7
Uganda Africa 1982 49.8 12939400 682.3
Uganda Africa 1987 51.5 15283050 617.7
Uganda Africa 1992 48.8 18252190 644.2
Uganda Africa 1997 44.6 21210254 816.6
Uganda Africa 2002 47.8 24739869 927.7
Uganda Africa 2007 51.5 29170398 1056.4
United Kingdom Europe 1952 69.2 50430000 9979.5
United Kingdom Europe 1957 70.4 51430000 11283.2
United Kingdom Europe 1962 70.8 53292000 12477.2
United Kingdom Europe 1967 71.4 54959000 14142.9
United Kingdom Europe 1972 72.0 56079000 15895.1
United Kingdom Europe 1977 72.8 56179000 17428.7
United Kingdom Europe 1982 74.0 56339704 18232.4
United Kingdom Europe 1987 75.0 56981620 21664.8
United Kingdom Europe 1992 76.4 57866349 22705.1
United Kingdom Europe 1997 77.2 58808266 26074.5
United Kingdom Europe 2002 78.5 59912431 29479.0
United Kingdom Europe 2007 79.4 60776238 33203.3
United States Americas 1952 68.4 157553000 13990.5
United States Americas 1957 69.5 171984000 14847.1
United States Americas 1962 70.2 186538000 16173.1
United States Americas 1967 70.8 198712000 19530.4
United States Americas 1972 71.3 209896000 21806.0
United States Americas 1977 73.4 220239000 24072.6
United States Americas 1982 74.7 232187835 25009.6
United States Americas 1987 75.0 242803533 29884.4
United States Americas 1992 76.1 256894189 32003.9
United States Americas 1997 76.8 272911760 35767.4
United States Americas 2002 77.3 287675526 39097.1
United States Americas 2007 78.2 301139947 42951.7
Uruguay Americas 1952 66.1 2252965 5716.8
Uruguay Americas 1957 67.0 2424959 6150.8
Uruguay Americas 1962 68.3 2598466 5603.4
Uruguay Americas 1967 68.5 2748579 5444.6
Uruguay Americas 1972 68.7 2829526 5703.4
Uruguay Americas 1977 69.5 2873520 6504.3
Uruguay Americas 1982 70.8 2953997 6920.2
Uruguay Americas 1987 71.9 3045153 7452.4
Uruguay Americas 1992 72.8 3149262 8137.0
Uruguay Americas 1997 74.2 3262838 9230.2
Uruguay Americas 2002 75.3 3363085 7727.0
Uruguay Americas 2007 76.4 3447496 10611.5
Venezuela Americas 1952 55.1 5439568 7689.8
Venezuela Americas 1957 57.9 6702668 9802.5
Venezuela Americas 1962 60.8 8143375 8423.0
Venezuela Americas 1967 63.5 9709552 9541.5
Venezuela Americas 1972 65.7 11515649 10505.3
Venezuela Americas 1977 67.5 13503563 13144.0
Venezuela Americas 1982 68.6 15620766 11152.4
Venezuela Americas 1987 70.2 17910182 9883.6
Venezuela Americas 1992 71.2 20265563 10733.9
Venezuela Americas 1997 72.1 22374398 10165.5
Venezuela Americas 2002 72.8 24287670 8605.0
Venezuela Americas 2007 73.7 26084662 11415.8
Vietnam Asia 1952 40.4 26246839 605.1
Vietnam Asia 1957 42.9 28998543 676.3
Vietnam Asia 1962 45.4 33796140 772.0
Vietnam Asia 1967 47.8 39463910 637.1
Vietnam Asia 1972 50.3 44655014 699.5
Vietnam Asia 1977 55.8 50533506 713.5
Vietnam Asia 1982 58.8 56142181 707.2
Vietnam Asia 1987 62.8 62826491 820.8
Vietnam Asia 1992 67.7 69940728 989.0
Vietnam Asia 1997 70.7 76048996 1385.9
Vietnam Asia 2002 73.0 80908147 1764.5
Vietnam Asia 2007 74.2 85262356 2441.6
West Bank and Gaza Asia 1952 43.2 1030585 1515.6
West Bank and Gaza Asia 1957 45.7 1070439 1827.1
West Bank and Gaza Asia 1962 48.1 1133134 2199.0
West Bank and Gaza Asia 1967 51.6 1142636 2649.7
West Bank and Gaza Asia 1972 56.5 1089572 3133.4
West Bank and Gaza Asia 1977 60.8 1261091 3682.8
West Bank and Gaza Asia 1982 64.4 1425876 4336.0
West Bank and Gaza Asia 1987 67.0 1691210 5107.2
West Bank and Gaza Asia 1992 69.7 2104779 6017.7
West Bank and Gaza Asia 1997 71.1 2826046 7110.7
West Bank and Gaza Asia 2002 72.4 3389578 4515.5
West Bank and Gaza Asia 2007 73.4 4018332 3025.3
Yemen, Rep. Asia 1952 32.5 4963829 781.7
Yemen, Rep. Asia 1957 34.0 5498090 804.8
Yemen, Rep. Asia 1962 35.2 6120081 825.6
Yemen, Rep. Asia 1967 37.0 6740785 862.4
Yemen, Rep. Asia 1972 39.8 7407075 1265.0
Yemen, Rep. Asia 1977 44.2 8403990 1829.8
Yemen, Rep. Asia 1982 49.1 9657618 1977.6
Yemen, Rep. Asia 1987 52.9 11219340 1971.7
Yemen, Rep. Asia 1992 55.6 13367997 1879.5
Yemen, Rep. Asia 1997 58.0 15826497 2117.5
Yemen, Rep. Asia 2002 60.3 18701257 2234.8
Yemen, Rep. Asia 2007 62.7 22211743 2280.8
Zambia Africa 1952 42.0 2672000 1147.4
Zambia Africa 1957 44.1 3016000 1312.0
Zambia Africa 1962 46.0 3421000 1452.7
Zambia Africa 1967 47.8 3900000 1777.1
Zambia Africa 1972 50.1 4506497 1773.5
Zambia Africa 1977 51.4 5216550 1588.7
Zambia Africa 1982 51.8 6100407 1408.7
Zambia Africa 1987 50.8 7272406 1213.3
Zambia Africa 1992 46.1 8381163 1210.9
Zambia Africa 1997 40.2 9417789 1071.4
Zambia Africa 2002 39.2 10595811 1071.6
Zambia Africa 2007 42.4 11746035 1271.2
Zimbabwe Africa 1952 48.5 3080907 406.9
Zimbabwe Africa 1957 50.5 3646340 518.8
Zimbabwe Africa 1962 52.4 4277736 527.3
Zimbabwe Africa 1967 54.0 4995432 569.8
Zimbabwe Africa 1972 55.6 5861135 799.4
Zimbabwe Africa 1977 57.7 6642107 685.6
Zimbabwe Africa 1982 60.4 7636524 788.9
Zimbabwe Africa 1987 62.4 9216418 706.2
Zimbabwe Africa 1992 60.4 10704340 693.4
Zimbabwe Africa 1997 46.8 11404948 792.4
Zimbabwe Africa 2002 40.0 11926563 672.0
Zimbabwe Africa 2007 43.5 12311143 469.7

Before we start

Table 1: Average life expectancy by continent, 1952-2007
Year Africa Americas Asia Europe Oceania
1952 39.1 53.3 46.3 64.4 69.3
1957 41.3 56.0 49.3 66.7 70.3
1962 43.3 58.4 51.6 68.5 71.1
1967 45.3 60.4 54.7 69.7 71.3
1972 47.5 62.4 57.3 70.8 71.9
1977 49.6 64.4 59.6 71.9 72.9
1982 51.6 66.2 62.6 72.8 74.3
1987 53.3 68.1 64.9 73.6 75.3
1992 53.6 69.6 66.5 74.4 76.9
1997 53.6 71.2 68.0 75.5 78.2
2002 53.3 72.4 69.2 76.7 79.7
2007 54.8 73.6 70.7 77.6 80.7

Loading the tidyverse libraries

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.3     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package to force all conflicts to become errors

The tidyverse has several components.

We’ll return to this message about Conflicts later.

Tidyverse components

  • library(tidyverse)
  • Loading tidyverse: ggplot2
  • Loading tidyverse: tibble
  • Loading tidyverse: tidyr
  • Loading tidyverse: readr
  • Loading tidyverse: purrr
  • Loading tidyverse: dplyr
  • Call the package and …
  • <| Draw graphs
  • <| Nicer data tables
  • <| Tidy your data
  • <| Get data into R
  • <| Fancy Iteration
  • <| Action verbs for tables

What R looks like

Code you can type and run:

## Inside code chunks, lines beginning with a # character are comments
## Comments are ignored by R

my_numbers <- c(1, 1, 2, 4, 1, 3, 1, 5) # Anything after a # character is ignored as well

Output:

my_numbers 
[1] 1 1 2 4 1 3 1 5

This is equivalent to running the code above, typing my_numbers at the console, and hitting enter.

What R looks like

By convention, code output in documents is prefixed by ##

Also by convention, outputting vectors, etc, gets a counter keeping track of the number of elements. For example,

letters
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"

Some things to know about R

0. It’s a calculator

  • Arithmetic
(31 * 12) / 2^4
[1] 23.25
sqrt(25)
[1] 5
log(100)
[1] 4.60517
log10(100)
[1] 2

0. It’s a calculator

  • Arithmetic
(31 * 12) / 2^4
[1] 23.25
sqrt(25)
[1] 5
log(100)
[1] 4.60517
log10(100)
[1] 2
  • Logic
4 < 10
[1] TRUE
4 > 2 & 1 > 0.5 # The "&" means "and"
[1] TRUE
4 < 2 | 1 > 0.5 # The "|" means "or"
[1] TRUE
4 < 2 | 1 < 0.5
[1] FALSE

Boolean and Logical operators

Logical equality and inequality (yielding a TRUE or FALSE result) is done with == and !=. Other logical operators include <, >, <=, >=, and ! for negation.

## A logical test
2 == 2 # Write `=` twice
[1] TRUE
## This will cause an error, because R will think you are trying to assign a value
2 = 2

## Error in 2 = 2 : invalid (do_set) left-hand side to assignment
3 != 7 # Write `!` and then `=` to make `!=`
[1] TRUE

1. Everything in R has a name

my_numbers # We created this a few minutes ago
[1] 1 1 2 4 1 3 1 5
letters  # This one is built-in
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
pi  # Also built-in
[1] 3.141593

Some names are forbidden

Or it’s a really bad idea to try to use them

TRUE
FALSE
Inf
NaN 
NA 
NULL

for
if
while
break
function

2. Everything is an object

There are a few built-in objects:

letters
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
pi
[1] 3.141593
LETTERS
 [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S"
[20] "T" "U" "V" "W" "X" "Y" "Z"

3. You can create objects

In fact, this is mostly what we will be doing.

Objects are created by assigning a thing to a name:

## name... gets ... this stuff
my_numbers <- c(1, 2, 3, 1, 3, 5, 25, 10)

## name ... gets ... the output of the function `c()`
your_numbers <- c(5, 31, 71, 1, 3, 21, 6, 52)

The c() function combines or concatenates things

The assignment operator

  • The assignment operator performs the action of creating objects
  • Use a keyboard shortcut to write it:
  • Press option and - on a Mac
  • Press alt and - on Windows

4. Do things to objects with functions

## this object... gets ... the output of this function
my_numbers <- c(1, 2, 3, 1, 3, 5, 25, 10)

your_numbers <- c(5, 31, 71, 1, 3, 21, 6, 52)
my_numbers
[1]  1  2  3  1  3  5 25 10

4. Do things to objects with functions

  • Functions can be identified by the parentheses after their names.
my_numbers 
[1]  1  2  3  1  3  5 25 10
## If you run this you'll get an error
mean()

What functions usually do

  • They take inputs to arguments
  • They perform actions
  • They produce, or return, outputs

mean(x = my_numbers)

What functions usually do

  • They take inputs to arguments
  • They perform actions
  • They produce, or return, outputs

mean(x = my_numbers)

[1] 6.25

What functions usually do

## Get the mean of what? Of x.
## You need to tell the function what x is
mean(x = my_numbers)
[1] 6.25
mean(x = your_numbers)
[1] 23.75

What functions usually do

If you don’t name the arguments, R assumes you are providing them in the order the function expects.

mean(your_numbers)
[1] 23.75

What functions usually do

What arguments? Which order? Read the function’s help page

help(mean)
## quicker
?mean
  • How to read an R help page?

What functions usually do

  • Arguments often tell the function what to do in specific circumstances
missing_numbers <- c(1:10, NA, 20, 32, 50, 104, 32, 147, 99, NA, 45)

mean(missing_numbers)
[1] NA
mean(missing_numbers, na.rm = TRUE)
[1] 32.44444

Or select from one of several options

## Look at ?mean to see what `trim` does
mean(missing_numbers, na.rm = TRUE, trim = 0.1)
[1] 27.25

What functions usually do

There are all kinds of functions. They return different things.

summary(my_numbers)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1.00    1.75    3.00    6.25    6.25   25.00 

What functions usually do

You can assign the output of a function to a name, which turns it into an object. (Otherwise it’ll send its output to the console.)

my_summary <- summary(my_numbers)

my_summary
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1.00    1.75    3.00    6.25    6.25   25.00 

What functions usually do

Objects hang around in your work environment until they are overwritten by you, or are deleted.

## rm() function removes objects
rm(my_summary)

my_summary

## Error: object 'my_summary' not found

Functions can be nested

c(1:20)
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
mean(c(1:20))
[1] 10.5
summary(mean(c(1:20)))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   10.5    10.5    10.5    10.5    10.5    10.5 
names(summary(mean(c(1:20))))
[1] "Min."    "1st Qu." "Median"  "Mean"    "3rd Qu." "Max."   
length(names(summary(mean(c(1:20)))))
[1] 6

Nested functions are evaluated from the inside out.

Use the pipe operator: |>

Instead of deeply nesting functions in parentheses, we can use the pipe operator:

c(1:20) |> mean() |> summary() |> names() |>  length()
[1] 6

Read this operator as “and then

Use the pipe operator: |>

Better, vertical space is free in R:

c(1:20) |> 
  mean() |> 
  summary() |> 
  names() |> 
  length()
[1] 6

Pipelines make code more readable

  • Not great, Bob:
  serve(stir(pour_in_pan(whisk(crack_eggs(get_from_fridge(eggs), into = "bowl"), len = 40), temp = "med-high")))
  • Notice how the first thing you read is the last operation performed.

Pipelines make code more readable

  • We can use vertical space and indents, but it’s really not much better:
serve(
  stir(
    pour_in_pan(
      whisk(
        crack_eggs(
          get_from_fridge(eggs), 
        into = "bowl"), 
      len = 40), 
    temp = "med-high")
  )
)

Pipelines make code more readable

  • Much nicer:
eggs |> 
  get_from_fridge() |> 
  crack_eggs(into = "bowl") |> 
  whisk(len = 40) |> 
  pour_in_pan(temp = "med-high") |> 
  stir() |> 
  serve()
  • We’ll still use nested parentheses quite a bit, often in the context of a function working inside a pipeline. But it’s good not to have too many levels of nesting.

Functions are bundled into packages

Packages are loaded into your working environment using the library() function:

## A package containing a dataset rather than functions
library(gapminder)

gapminder
# A tibble: 1,704 × 6
   country     continent  year lifeExp      pop gdpPercap
   <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
 1 Afghanistan Asia       1952    28.8  8425333      779.
 2 Afghanistan Asia       1957    30.3  9240934      821.
 3 Afghanistan Asia       1962    32.0 10267083      853.
 4 Afghanistan Asia       1967    34.0 11537966      836.
 5 Afghanistan Asia       1972    36.1 13079460      740.
 6 Afghanistan Asia       1977    38.4 14880372      786.
 7 Afghanistan Asia       1982    39.9 12881816      978.
 8 Afghanistan Asia       1987    40.8 13867957      852.
 9 Afghanistan Asia       1992    41.7 16317921      649.
10 Afghanistan Asia       1997    41.8 22227415      635.
# ℹ 1,694 more rows

Functions are bundled into packages

You need only install a package once (and occasionally update it):

## Do at least once for each package. Once done, not needed each time.
install.packages("palmerpenguins", repos = "http://cran.rstudio.com")

## Needed sometimes, especially after an R major version upgrade.
update.packages(repos = "http://cran.rstudio.com")

Functions are bundled into packages

But you must load the package in each R session before you can access its contents:

## To load a package, usually at the start of your RMarkdown document or script file
library(palmerpenguins)
penguins
# A tibble: 344 × 8
   species island    bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
   <fct>   <fct>              <dbl>         <dbl>             <int>       <int>
 1 Adelie  Torgersen           39.1          18.7               181        3750
 2 Adelie  Torgersen           39.5          17.4               186        3800
 3 Adelie  Torgersen           40.3          18                 195        3250
 4 Adelie  Torgersen           NA            NA                  NA          NA
 5 Adelie  Torgersen           36.7          19.3               193        3450
 6 Adelie  Torgersen           39.3          20.6               190        3650
 7 Adelie  Torgersen           38.9          17.8               181        3625
 8 Adelie  Torgersen           39.2          19.6               195        4675
 9 Adelie  Torgersen           34.1          18.1               193        3475
10 Adelie  Torgersen           42            20.2               190        4250
# ℹ 334 more rows
# ℹ 2 more variables: sex <fct>, year <int>

Grabbing a single function with ::

# A little glimpse of what we'll do soon
penguins |> 
  count(species, sex, year) |> 
  pivot_wider(names_from = year, values_from = n) |> 
  tinytable::tt()
species sex 2007 2008 2009
Adelie female 22 25 26
Adelie male 22 25 26
Adelie NA 6 NA NA
Chinstrap female 13 9 12
Chinstrap male 13 9 12
Gentoo female 16 22 20
Gentoo male 17 23 21
Gentoo NA 1 1 3

Remember those conflicts?

  • Notice how some functions in different packages have the same names.
  • Related concepts of namespaces and environments.

The scope of names

x <- c(1:10)
y <- c(90:100)

x
 [1]  1  2  3  4  5  6  7  8  9 10
y
 [1]  90  91  92  93  94  95  96  97  98  99 100
mean()

## Error in mean.default() : argument "x" is missing, with no default

The scope of names

mean(x) # argument names are internal to functions
[1] 5.5
mean(x = x)
[1] 5.5
mean(x = y)
[1] 95
x
 [1]  1  2  3  4  5  6  7  8  9 10
y
 [1]  90  91  92  93  94  95  96  97  98  99 100

5. Vector types; Object classes

I’m going to speak somewhat loosely here for now, and gloss over some distinctions between object classes and data structures, as well as kinds of objects and their attributes.

5. Vector types; Object classes

Objects are made of one or more vectors. A vector can, in effect, have a single type: integer, double, logical, character, factor, date, etc. That is, vectors are “atomic”. Complex objects are mostly lists of vectors of different sorts, or nested lists of other simpler objects that are themselves ultimately made up of vectors of

5. Vector types; Object classes

The object inspector in RStudio is your friend.

You can ask an object what it is at the console, too:

class(my_numbers)
[1] "numeric"
typeof(my_numbers)
[1] "double"

Types of vector

Types of vector

my_int <- c(1, 3, 5, 6, 10)
is.integer(my_int)
[1] FALSE
is.double(my_int)
[1] TRUE
my_int <- as.integer(my_int)
is.integer(my_int)
[1] TRUE
my_chr <- c("Mary", "had", "a", "little", "lamb")
is.character(my_chr)
[1] TRUE
my_lgl <- c(TRUE, FALSE, TRUE)
is.logical(my_lgl)
[1] TRUE

Types of vector

## Factors are for storing undordered or ordered categorical variables
x <- factor(c("Yes", "No", "No", "Maybe", "Yes", "Yes", "Yes", "No"))
x
[1] Yes   No    No    Maybe Yes   Yes   Yes   No   
Levels: Maybe No Yes
summary(x) # Alphabetical order by default
Maybe    No   Yes 
    1     3     4 
typeof(x)       # Underneath, a factor is a type of integer ...
[1] "integer"
attributes(x)   # ... with labels for its numbers, or "levels" 
$levels
[1] "Maybe" "No"    "Yes"  

$class
[1] "factor"
levels(x)
[1] "Maybe" "No"    "Yes"  
is.ordered(x)
[1] FALSE

Vectors can’t be heterogenous

  • Objects can be manually or automatically coerced from one class to another. Take care.
class(my_numbers)
[1] "numeric"
my_new_vector <- c(my_numbers, "Apple")

my_new_vector # vectors are homogeneous/atomic
[1] "1"     "2"     "3"     "1"     "3"     "5"     "25"    "10"    "Apple"
class(my_new_vector)
[1] "character"

Vectors can’t be heterogenous

  • Objects can be manually or automatically coerced from one class to another. Take care.
my_dbl <- c(2.1, 4.77, 30.111, 3.14519)
is.double(my_dbl)
[1] TRUE
my_dbl <- as.integer(my_dbl)

my_dbl
[1]  2  4 30  3

A table of data is a kind of list

gapminder # tibbles and data frames can contain vectors of different types
# A tibble: 1,704 × 6
   country     continent  year lifeExp      pop gdpPercap
   <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
 1 Afghanistan Asia       1952    28.8  8425333      779.
 2 Afghanistan Asia       1957    30.3  9240934      821.
 3 Afghanistan Asia       1962    32.0 10267083      853.
 4 Afghanistan Asia       1967    34.0 11537966      836.
 5 Afghanistan Asia       1972    36.1 13079460      740.
 6 Afghanistan Asia       1977    38.4 14880372      786.
 7 Afghanistan Asia       1982    39.9 12881816      978.
 8 Afghanistan Asia       1987    40.8 13867957      852.
 9 Afghanistan Asia       1992    41.7 16317921      649.
10 Afghanistan Asia       1997    41.8 22227415      635.
# ℹ 1,694 more rows
class(gapminder)
[1] "tbl_df"     "tbl"        "data.frame"
typeof(gapminder) # hmm
[1] "list"

A table of data is a kind of list

  • Lists are collections of vectors of possibly different types and lengths, or collections of more complex objects that are themselves ultimately made out of vectors. Underneath, most complex R objects are some kind of list with different components that can be accessed by some function that knows the names of the things inside the list.

  • A data frame is a list of vectors of the same length, where the vectors can be of different types (e.g. numeric, character, logical, etc).

  • A data frame is a natural representation of what most real tables of data look like. Having it be a basic sort of entity in the programming language IS ONE OF R’s BEST IDEAS AND EASILY UNDERRATED!

  • A tibble is an enhanced data frame

Some classes are versions of others

  • Base R’s trusty data.frame
library(socviz)
titanic
      fate    sex    n percent
1 perished   male 1364    62.0
2 perished female  126     5.7
3 survived   male  367    16.7
4 survived female  344    15.6
class(titanic)
[1] "data.frame"
## The `$` idiom picks out a named column here; 
## more generally, the named element of a list
titanic$percent  
[1] 62.0  5.7 16.7 15.6

Some classes are versions of others

  • Base R’s trusty data.frame
library(socviz)
titanic
      fate    sex    n percent
1 perished   male 1364    62.0
2 perished female  126     5.7
3 survived   male  367    16.7
4 survived female  344    15.6
class(titanic)
[1] "data.frame"
## The `$` idiom picks out a named column here; 
## more generally, the named element of a list
titanic$percent  
[1] 62.0  5.7 16.7 15.6
  • The Tidyverse’s enhanced tibble
## tibbles are build on data frames 
titanic_tb <- as_tibble(titanic) 
titanic_tb
# A tibble: 4 × 4
  fate     sex        n percent
  <fct>    <fct>  <dbl>   <dbl>
1 perished male    1364    62  
2 perished female   126     5.7
3 survived male     367    16.7
4 survived female   344    15.6
class(titanic_tb)
[1] "tbl_df"     "tbl"        "data.frame"
  • A data frame and a tibble are both fundamentally a list of vectors of the same length, where the vectors can be of different types (e.g. numeric, character, logical, etc)

All of this will be clearer in use

gss_sm
# A tibble: 2,867 × 32
    year    id ballot       age childs sibs   degree race  sex   region income16
   <dbl> <dbl> <labelled> <dbl>  <dbl> <labe> <fct>  <fct> <fct> <fct>  <fct>   
 1  2016     1 1             47      3 2      Bache… White Male  New E… $170000…
 2  2016     2 2             61      0 3      High … White Male  New E… $50000 …
 3  2016     3 3             72      2 3      Bache… White Male  New E… $75000 …
 4  2016     4 1             43      4 3      High … White Fema… New E… $170000…
 5  2016     5 3             55      2 2      Gradu… White Fema… New E… $170000…
 6  2016     6 2             53      2 2      Junio… White Fema… New E… $60000 …
 7  2016     7 1             50      2 2      High … White Male  New E… $170000…
 8  2016     8 3             23      3 6      High … Other Fema… Middl… $30000 …
 9  2016     9 1             45      3 5      High … Black Male  Middl… $60000 …
10  2016    10 3             71      4 1      Junio… White Male  Middl… $60000 …
# ℹ 2,857 more rows
# ℹ 21 more variables: relig <fct>, marital <fct>, padeg <fct>, madeg <fct>,
#   partyid <fct>, polviews <fct>, happy <fct>, partners <fct>, grass <fct>,
#   zodiac <fct>, pres12 <labelled>, wtssall <dbl>, income_rc <fct>,
#   agegrp <fct>, ageq <fct>, siblings <fct>, kids <fct>, religion <fct>,
#   bigregion <fct>, partners_rc <fct>, obama <dbl>
  • Tidyverse tools are generally type safe, meaning their functions return the same type of thing every time, or fail if they cannot do this. So it’s good to know about the various data types.

6. Arithmetic on vectors

  • In R, all numbers are vectors of different sorts. Even single numbers (“scalars”) are conceptually vectors of length 1.

  • Arithmetic on vectors (and arrays generally) follows a series of recycling rules that favor ease of expression of vectorized, “elementwise” operations.

  • See if you can predict what the following operations do:

6. Arithmetic on vectors

my_numbers
[1]  1  2  3  1  3  5 25 10
result1 <- my_numbers + 1

6. Arithmetic on vectors

my_numbers
[1]  1  2  3  1  3  5 25 10
result1 <- my_numbers + 1
result1
[1]  2  3  4  2  4  6 26 11

6. Arithmetic on vectors

result2 <- my_numbers + my_numbers

6. Arithmetic on vectors

result2 <- my_numbers + my_numbers
result2
[1]  2  4  6  2  6 10 50 20

6. Arithmetic on vectors

two_nums <- c(5, 10)

result3 <- my_numbers + two_nums

6. Arithmetic on vectors

two_nums <- c(5, 10)

result3 <- my_numbers + two_nums
result3
[1]  6 12  8 11  8 15 30 20

6. Arithmetic on vectors

three_nums <- c(1, 5, 10)

result4 <- my_numbers + three_nums
Warning in my_numbers + three_nums: longer object length is not a multiple of
shorter object length

6. Arithmetic on vectors

three_nums <- c(1, 5, 10)

result4 <- my_numbers + three_nums
Warning in my_numbers + three_nums: longer object length is not a multiple of
shorter object length
result4
[1]  2  7 13  2  8 15 26 15

Note that you get a warning here. It’ll still do it, though! Don’t ignore warnings until you understand what they mean.

7. R will be frustrating

  • The IDE tries its best to help you. Learn to attend to what it is trying to say.

Let’s Go!

Time to make a plot

Like before:

gapminder
# A tibble: 1,704 × 6
   country     continent  year lifeExp      pop gdpPercap
   <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
 1 Afghanistan Asia       1952    28.8  8425333      779.
 2 Afghanistan Asia       1957    30.3  9240934      821.
 3 Afghanistan Asia       1962    32.0 10267083      853.
 4 Afghanistan Asia       1967    34.0 11537966      836.
 5 Afghanistan Asia       1972    36.1 13079460      740.
 6 Afghanistan Asia       1977    38.4 14880372      786.
 7 Afghanistan Asia       1982    39.9 12881816      978.
 8 Afghanistan Asia       1987    40.8 13867957      852.
 9 Afghanistan Asia       1992    41.7 16317921      649.
10 Afghanistan Asia       1997    41.8 22227415      635.
# ℹ 1,694 more rows

Like before

library(tidyverse)
library(gapminder)

p <- ggplot(data = gapminder, 
            mapping = aes(x = gdpPercap, 
                          y = lifeExp)) 

p + geom_point()

What we did

library(gapminder)
  • Load the packages we need: tidyverse and gapminder

What we did

p <- ggplot(data = gapminder, 
            mapping = aes(x = gdpPercap, 
                          y = lifeExp)) 

]

  • New object named p gets the output of the ggplot() function, given these arguments
  • Notice how one of the arguments, mapping, is itself taking the output of a function named aes()

What we did

p + geom_point()
  • Show me the output of the p object and the geom_point() function.
  • The + here acts just like the |> pipe, but for ggplot functions only. (This is an accident of history.)

And what is R doing?

R objects are just lists of stuff to use or things to do

Objects are like Bento Boxes

The p object

Peek in with the object inspector

Peek in with the object inspector

Appendix: A Few More R Details

Logic: Watch out!

Here’s a gotcha. You might think you could write 3 < 5 & 7 and have it be interpreted as “Three is less than five and also less than seven [True or False?]”:

3 < 5 & 7
[1] TRUE

It seems to work!

Logic: Watch out!

But now try 3 < 5 & 1, where your intention is “Three is less than five and also less than one [True or False?]”

3 < 5 & 1
[1] TRUE
  • What’s happening is that 3 < 5 is evaluated first, and resolves to TRUE, leaving us with the expression TRUE & 1.
  • R interprets this as TRUE & as.logical(1).
  • In Boolean algebra, 1 resolves to TRUE. Any other number is FALSE. So,

Logic: Watch out!

TRUE & as.logical(1)
[1] TRUE
3 < 5 & 3 < 1
[1] FALSE
  • You have to make your comparisons explicit.

Logic and floating point arithmetic

Let’s evaluate 0.6 + 0.2 == 0.8

Logic and floating point arithmetic

Let’s evaluate 0.6 + 0.2 == 0.8

0.6 + 0.2 == 0.8
[1] TRUE

Logic and floating point arithmetic

Let’s evaluate 0.6 + 0.2 == 0.8

0.6 + 0.2 == 0.8
[1] TRUE

Now let’s try 0.6 + 0.3 == 0.9

Logic and floating point arithmetic

Let’s evaluate 0.6 + 0.2 == 0.8

0.6 + 0.2 == 0.8
[1] TRUE

Now let’s try 0.6 + 0.3 == 0.9

0.6 + 0.3 == 0.9
[1] FALSE

Er. That’s not right.

Welcome to floating point math!

In Base 10, you can’t precisely express fractions like \(\frac{1}{3}\) and \(\frac{1}{9}\). They come out as repeating decimals: 0.3333… or 0.1111… You can cleanly represent fractions that use a prime factor of the base, which in the case of Base 10 are 2 and 5.

Welcome to floating point math!

In Base 10, you can’t precisely express fractions like \(\frac{1}{3}\) and \(\frac{1}{9}\). They come out as repeating decimals: 0.3333… or 0.1111… You can cleanly represent fractions that use a prime factor of the base, which in the case of Base 10 are 2 and 5.

Computers represent numbers as binary (i.e. Base 2) floating-points. In Base 2, the only prime factor is 2. So \(\frac{1}{5}\) or \(\frac{1}{10}\) in binary would be repeating.

Logic and floating point arithmetic

When you do binary math on repeating numbers and convert back to decimals you get tiny leftovers, and this can mess up logical comparisons of equality. The all.equal() function exists for this purpose.

print(.1 + .2)
[1] 0.3
print(.1 + .2, digits=18)
[1] 0.300000000000000044
all.equal(.1 + .2, 0.3)
[1] TRUE

See e.g. https://0.30000000000000004.com

More later on why this might bite you, and how to deal with it

Assignment with =

  • You can use = as well as <- for assignment.
my_numbers = c(1, 2, 3, 1, 3, 5, 25)

my_numbers
[1]  1  2  3  1  3  5 25
  • On the other hand, = has a different meaning when used in functions.
  • I’m going to use <- for assignment throughout.
  • Be consistent either way.

Assignment with =

The other pipe: %>%

  • The Base R pipe operator, |> is a relatively recent addition to R.
  • Piping operations were originally introduced in a package called called magrittr, where it took the form %>%

The other pipe: %>%

  • The Base R pipe operator, |> is a relatively recent addition to R.
  • Piping operations were originally introduced in a package called called magrittr, where it took the form %>%
  • It’s been so successful, a version of it has been incorporated into Base R. It mostly but does not quite work the same way as %>% in every case.

The other pipe: %>%

  • The Base R pipe operator, |> is a relatively recent addition to R.
  • Piping operations were originally introduced in a package called called magrittr, where it took the form %>%
  • It’s been so successful, a version of it has been incorporated into Base R. It mostly but does not quite work the same way as %>% in every case. We’ll use the Base R pipe in this course, but you’ll see the Magrittr pipe a lot out in the world.

Object classes

Objects can have more than one (nested) class:

summary(my_numbers)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  1.000   1.500   3.000   5.714   4.000  25.000 
my_smry <- summary(my_numbers) # remember, outputs can be assigned to a name, creating an object

class(summary(my_numbers)) # functions can be nested, and are evaluated from the inside out
[1] "summaryDefault" "table"         
class(my_smry) # equivalent to the previous line
[1] "summaryDefault" "table"         

Object classes

typeof(my_smry)
[1] "double"
attributes(my_smry)
$names
[1] "Min."    "1st Qu." "Median"  "Mean"    "3rd Qu." "Max."   

$class
[1] "summaryDefault" "table"         
## In this case, the functions extract the corresponding attribute
class(my_smry)
[1] "summaryDefault" "table"         
names(my_smry)
[1] "Min."    "1st Qu." "Median"  "Mean"    "3rd Qu." "Max."