R is a flexible, convenient and powerful tool for managing and analysing data, and well as for creating publication materials such as visualisations, reports and dashboards. RStudio is an IDE (Integrated Development Environment) for using R. R is free to install, as is the open source edition of RStudio (there are professional and hosted versions of RStudio which are not free). In my opinion, R and RStudio provide at least as much of the functionality you would see in other quite expensive statistical computing platforms.
This guide will be just enough to get you going. It does not show the full range of features for every function. It uses tidyverse and isn’t very concerned with technical stuff going on under the hood.
The help function in R provides great documentation and examples for
all functions. Use it by running ?
followed by the name of
the function. For example, to find out more about the function
select
just run ?select
.
There are very good cheatsheets for different packages on the RStudio website. One cheatsheet that you won’t find on that page but which I think is really useful for beginners is the one on data wrangling (although some of the functions on that are out of date).
Finally there are a couple of good online forums where users post their coding problems and other users try to provide solutions. One of the most active of these is Stack Overflow. Try searching or posting your problem there if you are getting stuck. Users are more likely to be able to help if you provide a reproducible example, so try to provide enough code so that they can recreate the problem themselves.
R needs to access the web in order to download packages from CRAN. You may also want to import data from the web, e.g. through the csodata package for importing data from the CSO website. If you are having trouble with these steps then it may be because your organisation has not allowed R to access the web, so you might need to contact your IT department. If you are in the same organisation as me and you are experiencing difficulties, let me know, there are some settings that I can pass on that will help.
The capabilities of R are extended through a wide array of packages. As a beginner with R, it is likely that all of the extra packages that you use will be downloaded from an online repository of packages called CRAN, which stands for the Comprehensive R Archive Network. Packages are downloaded from CRAN within the R environment, you rarely have to visit the CRAN website at all. There is a stringent process to getting your package included on CRAN which includes a series of checks and testing, so there is a very low likelihood of you ever downloading malicious code from CRAN.
Tidyverse is a very widely used collection of packages which makes it easier to write and read code in R. It is so commonly used that it is almost ubiquitous, so I wouldn’t hesitate to recommend that you begin learning R through tidyverse. If you are not using tidyverse and you are only using the handful of default packages in R then you would say that you are using ‘base R’, where ‘base’ is the main default package (I think there are seven default packages). This is not an ‘either-or’ decision, when you load tidyverse it is perfectly fine to write code using the ‘base’ set of functions. It’s good to understand base R, but I think it’s ok to pick this up as you go along rather than starting out with exclusive use of base R.
To install a package you use the function
install.packages
, so to install the tidyverse packages you
run install.packages("tidyverse")
. Then to use the package
you have to load it into your environment using the function
library
, so to use the tidyverse functions and features you
run library(tidyverse)
(note you need inverted commas for
install.packages
but not for library
).
You only have to install a package once, or again if you want to
update the package, but you have to load the package every time you
start a new session in R. Note that the default packages that
come with R do not have to be installed or loaded using
install.packages
and library
.
Within tidyverse there are eight core packages, and then a couple of
extra tidyverse packages. All of these are installed when you run
install.packages("tidyverse")
, but only the core packages
are loaded when you run library(tidyverse)
(plus a couple
of back-end ones that you don’t really see). This is not something that
you have to worry too much about, it just means that you have to run an
extra library
line when you want to use one of those extra
tidyverse packages that are beyond the core ones. Extra tidyverse
packages that I would often use include scales for formatting axes,
lubridate for handling dates and times, and readxl for reading and
writing Excel files. Some packages I like which aren’t from tidyverse
(and require separate installation) include sf for maps, tictoc for
timing how long it takes code to run, beepr for making ‘ding’ noises
after code has finished running, and knitr for making html documents
like this one.
A diagram which summarises the different types of package is shown below. The five main types (A, B, C, D and E) are described below. As a beginner you will probably only encounter types A and B.
install.packages
or
library
. Examples include base which has lots of
fundamental functions and stats which has functions for statistical
analysis.
install.packages("tidyverse")
and loaded
using library(tidyverse)
. Examples include dplyr for data
manipulation and stringr for manipulating strings.
install.packages("tidyverse")
but they are
not loaded with library(tidyverse)
, you
have to use a separate library
line to load these. Examples
include lubridate for managing dates and times and haven for reading
more unusual file types. You might use these kinds of packages as an
intermediate user but not so much as a beginner.
install.packages
and loaded using
library
. Examples include csodata for downloading CSO data,
and caret for machine learning. As a beginner you will not encounter
many of these.
install.packages
or some other function, but once installed
they can be loaded using library
.
A screenshot of RStudio is shown below. There are four main panels. This guide will not go through every single feature in RStudio, but will hopefully be enough to get you started.
View(dataset_name)
.mtcars
, which contains information
on 32 cars. In the code in the screenshot, I have used
mtcars
to make a new duplicate dataset called
my_data
which does appear in the environment panel.Vectors are one-dimensional objects containing the same type of data,
so all entries are either numerical, character (strings) or logical
(TRUE or FALSE). These are created using the function c()
,
with the elements separated by commas. A vector of three names would
look like: c("Andy", "Betty" , "Carol")
. A vector of three
numbers would look like: c(71, 8.5 , 0.13)
. You can make a
vector of consecutive integers by putting a colon (:
)
between the low and high integer, so 5:8
is equivalent to
c(5, 6, 7, 8)
. Finally, you can make a logical vector like
so: c(TRUE, FALSE, FALSE)
.
Most of the data objects you’ll encounter will be dataframes, which can be thought of as tables with rows and columns. Each column has a particular type which can be numerical, character (strings) or logical (TRUE or FALSE). The columns of dataframes have names. The rows of dataframes can have names too, but this is a stupid feature, it makes more sense to just use another column for whatever information is stored as the row name.
In tidyverse, there is an improved version of a dataframe called a tibble. The differences between a tibble and a regular dataframe are quite subtle from the beginner’s perspective and they can more-or-less be handled in the same way, so I wouldn’t worry about it for now. Just be aware that if you see a reference to a ‘tibble’ then it’s a special type of a dataframe.
There are other objects in R including matrices, arrays and lists. You can skip this section if you like as it is unlikely you will need to deal with them as a beginner.
A matrix is a 2D table with only one type of data (usually all numeric). An array is more general than a matrix, it can have any number of dimensions. I don’t think I have ever had to use matrices or arrays.
A list is a 1D structure where the elements don’t have to be of the same type, i.e. the first element could be a number and the second element could be a string. But moreover, the elements of lists can be vectors, dataframes, or even more lists. Dealing with lists would be for an intermediate or advanced course, but even as a beginner you might find yourself working with a package which uses lists. Often in these cases, the lists have a specific structure, or ‘class’, which is recognised by the package. Don’t panic, there will usually be a helpful vignette for you to follow.This section covers just a couple of fundamental tools from Base R. . I prefer to do all my data filtering, manipulation and aggregation using tidyverse functions, so those kinds of processes are not covered here.
After you write some code in the scripting window you will want to run it. My preferred way to run code is to place the cursor somewhere in the line of code and press ‘Ctrl Enter’. As well as running the line of code, the cursor will then jump to the next line of code, and this is useful as it helps you to run several concurrent lines of code by holding ‘Ctrl’ and tapping ‘Enter’.
You can also write code directly in the console. After you write your code there, simply hit ‘Enter’ and it will run.
There are other ways of running code from your scripting window. Pressing the ‘Run’ button at the top of the scripting window has the same effect as hitting ‘Ctrl Enter’. Instead of placing the cursor in the line of code you can select the whole line of code. You can select several lines of code and then hit ‘Ctrl Enter’ or ‘Run’, and they will all run in the order they appear.
Finally, you can run all of the code in the script by pressing ‘Ctrl Alt r’. Note that this also saves the script.<-
To create objects, we use the assignment operator: <-
You can quickly write this operator by hitting ‘Alt -’. Let’s make an
object x
which has a value of 5.
x <- 5
After you run this line of code you will see the code appear in the
Console, and x
appear in the Environment panel along with
its value, 5.
To output the value of x
, we can write x
in
a line on its own and run that line. The value 5 will appear in the
Console. We can also run x + 2
to return
7
.
x
## [1] 5
x + 2
## [1] 7
Let’s make a vector containing a couple of numeric values using the
function c
, and output it as well.
numbers_vec <- c(5,6,7,8,9)
numbers_vec
## [1] 5 6 7 8 9
We can make a vector of strings by putting each string in inverted commas. We can use single or double inverted commas.
names_vec <- c("Mary", "Louise", "Tom")
names_vec
## [1] "Mary" "Louise" "Tom"
And we can make a logical vector like so. Note that I am writing
T
and F
which are abbreviations of
TRUE
and FALSE
and work in exactly the same
way.
logical_vec <- c(T, F, F, T)
logical_vec
## [1] TRUE FALSE FALSE TRUE
I find that I very rarely need to make dataframes from scratch. As a beginner you usually work with built-in sample dataframes, and as a regular user you usually work with dataframes created from data from files or from the web.
Although the built-in datasets don’t appear in the Environment panel,
they are all there waiting to be used. We will make our own copy of a
dataset from a study on oesophageal cancer which is called
esoph
. Our copy of this dataset will be called
cancer
. Note that cancer
will appear in the
Environment panel.
cancer <- esoph
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 0-39g/day | 10-19 | 0 | 10 |
25-34 | 0-39g/day | 20-29 | 0 | 6 |
25-34 | 0-39g/day | 30+ | 0 | 5 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 40-79 | 10-19 | 0 | 7 |
25-34 | 40-79 | 20-29 | 0 | 4 |
25-34 | 40-79 | 30+ | 0 | 7 |
25-34 | 80-119 | 0-9g/day | 0 | 2 |
25-34 | 80-119 | 10-19 | 0 | 1 |
25-34 | 80-119 | 30+ | 0 | 2 |
25-34 | 120+ | 0-9g/day | 0 | 1 |
25-34 | 120+ | 10-19 | 1 | 0 |
25-34 | 120+ | 20-29 | 0 | 1 |
25-34 | 120+ | 30+ | 0 | 2 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 |
35-44 | 0-39g/day | 10-19 | 1 | 13 |
35-44 | 0-39g/day | 20-29 | 0 | 7 |
35-44 | 0-39g/day | 30+ | 0 | 8 |
35-44 | 40-79 | 0-9g/day | 0 | 35 |
35-44 | 40-79 | 10-19 | 3 | 20 |
35-44 | 40-79 | 20-29 | 1 | 13 |
35-44 | 40-79 | 30+ | 0 | 8 |
35-44 | 80-119 | 0-9g/day | 0 | 11 |
35-44 | 80-119 | 10-19 | 0 | 6 |
35-44 | 80-119 | 20-29 | 0 | 2 |
35-44 | 80-119 | 30+ | 0 | 1 |
35-44 | 120+ | 0-9g/day | 2 | 1 |
35-44 | 120+ | 10-19 | 0 | 3 |
35-44 | 120+ | 20-29 | 2 | 2 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 |
45-54 | 0-39g/day | 10-19 | 0 | 18 |
45-54 | 0-39g/day | 20-29 | 0 | 10 |
45-54 | 0-39g/day | 30+ | 0 | 4 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
45-54 | 40-79 | 10-19 | 4 | 17 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30+ | 5 | 2 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
45-54 | 80-119 | 10-19 | 6 | 8 |
45-54 | 80-119 | 20-29 | 1 | 4 |
45-54 | 80-119 | 30+ | 2 | 2 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
45-54 | 120+ | 20-29 | 2 | 1 |
45-54 | 120+ | 30+ | 4 | 0 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30+ | 4 | 2 |
55-64 | 40-79 | 0-9g/day | 9 | 31 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 20-29 | 4 | 13 |
55-64 | 40-79 | 30+ | 3 | 3 |
55-64 | 80-119 | 0-9g/day | 9 | 9 |
55-64 | 80-119 | 10-19 | 8 | 7 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30+ | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 10-19 | 6 | 1 |
55-64 | 120+ | 20-29 | 2 | 1 |
55-64 | 120+ | 30+ | 5 | 1 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 0-39g/day | 20-29 | 2 | 5 |
65-74 | 0-39g/day | 30+ | 0 | 2 |
65-74 | 40-79 | 0-9g/day | 17 | 17 |
65-74 | 40-79 | 10-19 | 3 | 7 |
65-74 | 40-79 | 20-29 | 5 | 4 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
65-74 | 80-119 | 10-19 | 4 | 8 |
65-74 | 80-119 | 20-29 | 2 | 1 |
65-74 | 80-119 | 30+ | 1 | 0 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
65-74 | 120+ | 10-19 | 1 | 1 |
65-74 | 120+ | 20-29 | 1 | 0 |
65-74 | 120+ | 30+ | 1 | 0 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
75+ | 0-39g/day | 30+ | 1 | 2 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 20-29 | 0 | 3 |
75+ | 40-79 | 30+ | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
75+ | 120+ | 0-9g/day | 2 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
Like I say, this is something you rarely need to do. Dataframes are
created using a bunch of named vectors separated by commas, within the
function data.frame()
. Here I am making a character
variable called name
, a numerical variable called
age
, and a logical variable called
married
.
some_dataframe <- data.frame(name = c("Mary", "Louise", "Tom"),
age = c(30, 40, 50),
married = c(FALSE, TRUE, TRUE))
[]
and $
We can use the square brackets []
to access specific
elements within vectors and dataframes. Let’s create the vector
numbers_vec
as before and access the second element using
numbers_vec[2]
.
numbers_vec <- c(5,6,7,8,9)
numbers_vec[2]
## [1] 6
Similarly we can access the ith row and the jth
column of a dataframe using [i,j]
. Let’s go to the fifth
row of the second column of the cancer
dataframe using
cancer[5,2]
.
cancer <- esoph
cancer[5,2]
## [1] 40-79
## Levels: 0-39g/day < 40-79 < 80-119 < 120+
You’ll see in the output above that as well as giving the contents of
that cell (which is 40-79
), it shows:
Levels: 0-39g/day < 40-79 < 80-119 < 120+
. This is
because this particular variable (alcgp
) is stored as a
factor. A full discussion of factors would be better
placed in an intermediate guide to R, but in this context a factor is a
variable where each element can have one of several possible values or
levels. The allowed levels of the variable
alcgp
are 0-39g/day
, 40-79
,
80-119
and 120+
. The levels of a factor can be
given an order, in which case we would say that the variable is an
‘ordinal variable’. Factors have many uses. In particular they can be
used for sorting string variables in an order that is not alphabetical,
for example Low
, Medium
,
High
.
We can access a whole row or a whole column of a dataframe by using
square brackets with either i
or j
left blank.
For example, we can access the whole fifth row of cancer
using cancer[5,]
:
cancer[5,]
## agegp alcgp tobgp ncases ncontrols
## 5 25-34 40-79 0-9g/day 0 27
To access a whole column we can leave i
blank and
include the value for j
(like cancer[,2]
).
Alternatively, and perhaps more practically, we can refer to the column
by name. Here we will output the column agegp
using
cancer$agegp
, and this will print all 88 elements (along
with the list of levels, which are ordered).
cancer$agegp
## [1] 25-34 25-34 25-34 25-34 25-34 25-34 25-34 25-34 25-34 25-34 25-34 25-34
## [13] 25-34 25-34 25-34 35-44 35-44 35-44 35-44 35-44 35-44 35-44 35-44 35-44
## [25] 35-44 35-44 35-44 35-44 35-44 35-44 45-54 45-54 45-54 45-54 45-54 45-54
## [37] 45-54 45-54 45-54 45-54 45-54 45-54 45-54 45-54 45-54 45-54 55-64 55-64
## [49] 55-64 55-64 55-64 55-64 55-64 55-64 55-64 55-64 55-64 55-64 55-64 55-64
## [61] 55-64 55-64 65-74 65-74 65-74 65-74 65-74 65-74 65-74 65-74 65-74 65-74
## [73] 65-74 65-74 65-74 65-74 65-74 75+ 75+ 75+ 75+ 75+ 75+ 75+
## [85] 75+ 75+ 75+ 75+
## Levels: 25-34 < 35-44 < 45-54 < 55-64 < 65-74 < 75+
As mentioned in one of the collapsible sections above, the columns of
dataframes are themselves vectors. So we can access the fifth element of
the column agegp
using square brackets, e.g.:
cancer$agegp[5]
## [1] 25-34
## Levels: 25-34 < 35-44 < 45-54 < 55-64 < 65-74 < 75+
The easiest way to view a dataframe is by clicking on it in the
Environment panel. The dataframe will then appear in its own window in
the top-left panel, and you can scroll and search within that window.
Note that View(
dataset name)
will
appear in the console. Running that line of code would have the same
effect.
Beside the name of each dataframe in the environment panel is a blue
arrow which allows you to expand the dataset to look at the variable
names and the first couple of values. This view also tells you the type
of each value (logical (logi), numeric (num) or character (chr)). It
also tells you if a variable is stored as a factor, as is the case for
three of the variables in the cancer
dataset.
A very similar view to that produced by expanding the values in the
environment panel can be achieved using the glimpse
function (e.g. run glimpse(cancer)
). This is output to
console.
You can output the first or last couple of lines of a dataframe to
console using the head
and tail
functions
(e.g. run head(cancer)
). By default it prints the first (or
last) 6 rows, but you can change that using the extra argument
n
(e.g. run head(cancer , n=10)
).
You can print an entire dataframe to console by simply running the name of the dataframe on its own.
We’ll go through five of the most important functions in R. These are all from tidyverse, so you will need to load the tidyverse package before progressing.
library(tidyverse)
Most of the examples below start with the dataset cancer
which was created as a copy of esoph
as shown earlier. In
each case the dataset cancer
is pushed into a function and
the result is shown below. In practice what you might do is create a new
dataset to capture the output, by writing the name of your dataset and
the assignment operator <-
at the top, so instead
of…
cancer %>%
some_function()
…you might have…
my_new_dataset <- cancer %>%
some_function()
The pipe is a tool which allows you to pass an object such as a
dataframe through a series of operations. It makes code much easier to
read and write. The way it works is that it takes whatever is on the
left hand side and pushes it through the function on the right hand
side. The shortcut for writing a pipe is ‘Ctrl Shift m’. Suppose we have
a dataset called my_dataset
and we want to apply a function
called some_function
, the following two lines of code would
be equivalent:
my_dataset %>% some_function()
# the following line is equivalent:
some_function(my_dataset)
It is clearer why the pipe makes code easier to read and write when
you consider a series of functions which may each have additional
arguments. Suppose we want to subsequently apply another function called
another_function
, and furthermore that the two functions
require argument_A
and argument_B
. Compare the
following two equivalent lines of code.
my_dataset %>%
some_function(argument_A = 10) %>%
another_function(argument_B = 20)
# the following line is equivalent, but much harder to read!
another_function( some_function( my_dataset , argument_A = 10), argument_B = 20 )
The pipe always passes the left-hand side as the first argument to the function on the right hand side. What does this mean? It means that functions that work with the pipe have to be set up so that their first argument is the object that is being manipulated (usually a dataframe). All of the tidyverse functions are set up in this way, so it’s not something that you need to worry too much about. If you were creating your own function for manipulating a dataframe in some way (something for an intermediate course) and wanted it to be compatible with the pipe, you would set it up so that the first argument to your function was the incoming dataframe.
The select
function allows you to select specific
columns from a dataframe. Like other tidyverse
functions, the first argument is the dataframe, so it can be used with
the pipe. Then you can pass the names of variables that you want to
keep. Here we’ll take the cancer
dataframe and keep just
the variables agegp
and alcgp
.
cancer %>%
select(agegp , alcgp)
agegp | alcgp |
---|---|
25-34 | 0-39g/day |
25-34 | 0-39g/day |
25-34 | 0-39g/day |
25-34 | 0-39g/day |
25-34 | 40-79 |
25-34 | 40-79 |
25-34 | 40-79 |
25-34 | 40-79 |
25-34 | 80-119 |
25-34 | 80-119 |
25-34 | 80-119 |
25-34 | 120+ |
25-34 | 120+ |
25-34 | 120+ |
25-34 | 120+ |
35-44 | 0-39g/day |
35-44 | 0-39g/day |
35-44 | 0-39g/day |
35-44 | 0-39g/day |
35-44 | 40-79 |
35-44 | 40-79 |
35-44 | 40-79 |
35-44 | 40-79 |
35-44 | 80-119 |
35-44 | 80-119 |
35-44 | 80-119 |
35-44 | 80-119 |
35-44 | 120+ |
35-44 | 120+ |
35-44 | 120+ |
45-54 | 0-39g/day |
45-54 | 0-39g/day |
45-54 | 0-39g/day |
45-54 | 0-39g/day |
45-54 | 40-79 |
45-54 | 40-79 |
45-54 | 40-79 |
45-54 | 40-79 |
45-54 | 80-119 |
45-54 | 80-119 |
45-54 | 80-119 |
45-54 | 80-119 |
45-54 | 120+ |
45-54 | 120+ |
45-54 | 120+ |
45-54 | 120+ |
55-64 | 0-39g/day |
55-64 | 0-39g/day |
55-64 | 0-39g/day |
55-64 | 0-39g/day |
55-64 | 40-79 |
55-64 | 40-79 |
55-64 | 40-79 |
55-64 | 40-79 |
55-64 | 80-119 |
55-64 | 80-119 |
55-64 | 80-119 |
55-64 | 80-119 |
55-64 | 120+ |
55-64 | 120+ |
55-64 | 120+ |
55-64 | 120+ |
65-74 | 0-39g/day |
65-74 | 0-39g/day |
65-74 | 0-39g/day |
65-74 | 0-39g/day |
65-74 | 40-79 |
65-74 | 40-79 |
65-74 | 40-79 |
65-74 | 80-119 |
65-74 | 80-119 |
65-74 | 80-119 |
65-74 | 80-119 |
65-74 | 120+ |
65-74 | 120+ |
65-74 | 120+ |
65-74 | 120+ |
75+ | 0-39g/day |
75+ | 0-39g/day |
75+ | 0-39g/day |
75+ | 40-79 |
75+ | 40-79 |
75+ | 40-79 |
75+ | 40-79 |
75+ | 80-119 |
75+ | 80-119 |
75+ | 120+ |
75+ | 120+ |
We can also drop variables by putting a minus sign in front of them.
Here we’ll drop the variables alcgp
and
tobgp
.
cancer %>%
select(-alcgp , -tobgp)
agegp | ncases | ncontrols |
---|---|---|
25-34 | 0 | 40 |
25-34 | 0 | 10 |
25-34 | 0 | 6 |
25-34 | 0 | 5 |
25-34 | 0 | 27 |
25-34 | 0 | 7 |
25-34 | 0 | 4 |
25-34 | 0 | 7 |
25-34 | 0 | 2 |
25-34 | 0 | 1 |
25-34 | 0 | 2 |
25-34 | 0 | 1 |
25-34 | 1 | 0 |
25-34 | 0 | 1 |
25-34 | 0 | 2 |
35-44 | 0 | 60 |
35-44 | 1 | 13 |
35-44 | 0 | 7 |
35-44 | 0 | 8 |
35-44 | 0 | 35 |
35-44 | 3 | 20 |
35-44 | 1 | 13 |
35-44 | 0 | 8 |
35-44 | 0 | 11 |
35-44 | 0 | 6 |
35-44 | 0 | 2 |
35-44 | 0 | 1 |
35-44 | 2 | 1 |
35-44 | 0 | 3 |
35-44 | 2 | 2 |
45-54 | 1 | 45 |
45-54 | 0 | 18 |
45-54 | 0 | 10 |
45-54 | 0 | 4 |
45-54 | 6 | 32 |
45-54 | 4 | 17 |
45-54 | 5 | 10 |
45-54 | 5 | 2 |
45-54 | 3 | 13 |
45-54 | 6 | 8 |
45-54 | 1 | 4 |
45-54 | 2 | 2 |
45-54 | 4 | 0 |
45-54 | 3 | 1 |
45-54 | 2 | 1 |
45-54 | 4 | 0 |
55-64 | 2 | 47 |
55-64 | 3 | 19 |
55-64 | 3 | 9 |
55-64 | 4 | 2 |
55-64 | 9 | 31 |
55-64 | 6 | 15 |
55-64 | 4 | 13 |
55-64 | 3 | 3 |
55-64 | 9 | 9 |
55-64 | 8 | 7 |
55-64 | 3 | 3 |
55-64 | 4 | 0 |
55-64 | 5 | 5 |
55-64 | 6 | 1 |
55-64 | 2 | 1 |
55-64 | 5 | 1 |
65-74 | 5 | 43 |
65-74 | 4 | 10 |
65-74 | 2 | 5 |
65-74 | 0 | 2 |
65-74 | 17 | 17 |
65-74 | 3 | 7 |
65-74 | 5 | 4 |
65-74 | 6 | 7 |
65-74 | 4 | 8 |
65-74 | 2 | 1 |
65-74 | 1 | 0 |
65-74 | 3 | 1 |
65-74 | 1 | 1 |
65-74 | 1 | 0 |
65-74 | 1 | 0 |
75+ | 1 | 17 |
75+ | 2 | 4 |
75+ | 1 | 2 |
75+ | 2 | 3 |
75+ | 1 | 2 |
75+ | 0 | 3 |
75+ | 1 | 0 |
75+ | 1 | 0 |
75+ | 1 | 0 |
75+ | 2 | 0 |
75+ | 1 | 0 |
There are a couple of really useful ‘selection helper’ functions that
help you to keep or drop variables which contain certain string
patterns. For example, we can use select
with the selection
helper function contains
with the argument
"gp"
to select only variables whose names contain the
string pattern “gp” (so agegp
, alcgp
and
tobgp
). The functions starts_with
and
ends_width
are similar but the variable name has to start
or end with the string pattern.
Here we will put a minus in front of contains
to
drop variables containing the string pattern “gp”.
cancer %>%
select(-contains("gp"))
ncases | ncontrols |
---|---|
0 | 40 |
0 | 10 |
0 | 6 |
0 | 5 |
0 | 27 |
0 | 7 |
0 | 4 |
0 | 7 |
0 | 2 |
0 | 1 |
0 | 2 |
0 | 1 |
1 | 0 |
0 | 1 |
0 | 2 |
0 | 60 |
1 | 13 |
0 | 7 |
0 | 8 |
0 | 35 |
3 | 20 |
1 | 13 |
0 | 8 |
0 | 11 |
0 | 6 |
0 | 2 |
0 | 1 |
2 | 1 |
0 | 3 |
2 | 2 |
1 | 45 |
0 | 18 |
0 | 10 |
0 | 4 |
6 | 32 |
4 | 17 |
5 | 10 |
5 | 2 |
3 | 13 |
6 | 8 |
1 | 4 |
2 | 2 |
4 | 0 |
3 | 1 |
2 | 1 |
4 | 0 |
2 | 47 |
3 | 19 |
3 | 9 |
4 | 2 |
9 | 31 |
6 | 15 |
4 | 13 |
3 | 3 |
9 | 9 |
8 | 7 |
3 | 3 |
4 | 0 |
5 | 5 |
6 | 1 |
2 | 1 |
5 | 1 |
5 | 43 |
4 | 10 |
2 | 5 |
0 | 2 |
17 | 17 |
3 | 7 |
5 | 4 |
6 | 7 |
4 | 8 |
2 | 1 |
1 | 0 |
3 | 1 |
1 | 1 |
1 | 0 |
1 | 0 |
1 | 17 |
2 | 4 |
1 | 2 |
2 | 3 |
1 | 2 |
0 | 3 |
1 | 0 |
1 | 0 |
1 | 0 |
2 | 0 |
1 | 0 |
You can select all the columns of a particular type (numerical,
character, etc.) using the selection helper function where
.
It takes as its argument the name of another function which performs a
logical check on a variable, examples include is.numeric
,
is.character
, is.logical
,
is.factor
. Let’s select the numerical variables.
cancer %>%
select(where(is.numeric))
ncases | ncontrols |
---|---|
0 | 40 |
0 | 10 |
0 | 6 |
0 | 5 |
0 | 27 |
0 | 7 |
0 | 4 |
0 | 7 |
0 | 2 |
0 | 1 |
0 | 2 |
0 | 1 |
1 | 0 |
0 | 1 |
0 | 2 |
0 | 60 |
1 | 13 |
0 | 7 |
0 | 8 |
0 | 35 |
3 | 20 |
1 | 13 |
0 | 8 |
0 | 11 |
0 | 6 |
0 | 2 |
0 | 1 |
2 | 1 |
0 | 3 |
2 | 2 |
1 | 45 |
0 | 18 |
0 | 10 |
0 | 4 |
6 | 32 |
4 | 17 |
5 | 10 |
5 | 2 |
3 | 13 |
6 | 8 |
1 | 4 |
2 | 2 |
4 | 0 |
3 | 1 |
2 | 1 |
4 | 0 |
2 | 47 |
3 | 19 |
3 | 9 |
4 | 2 |
9 | 31 |
6 | 15 |
4 | 13 |
3 | 3 |
9 | 9 |
8 | 7 |
3 | 3 |
4 | 0 |
5 | 5 |
6 | 1 |
2 | 1 |
5 | 1 |
5 | 43 |
4 | 10 |
2 | 5 |
0 | 2 |
17 | 17 |
3 | 7 |
5 | 4 |
6 | 7 |
4 | 8 |
2 | 1 |
1 | 0 |
3 | 1 |
1 | 1 |
1 | 0 |
1 | 0 |
1 | 17 |
2 | 4 |
1 | 2 |
2 | 3 |
1 | 2 |
0 | 3 |
1 | 0 |
1 | 0 |
1 | 0 |
2 | 0 |
1 | 0 |
Note that you can select the opposite (non-numeric columns, for
example), by putting a minus or the ‘NOT’ logical operator
!
in front of the where
function.
The filter
function allows you to select specific
rows from a dataframe. Again the first argument is the
dataframe so that it can be used by the pipe. Then you provide some
logical expression based on the variables in the dataframe, and cases
where that expression is true are retained in the output. Let’s take the
cancer
dataframe again and filter out the rows where
tobgp
is equal to "30+"
. Note the use of the
double equals ==
which is the binary comparison operator
for ‘equals’.
cancer %>%
filter(togbp == "30+")
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 30+ | 0 | 5 |
25-34 | 40-79 | 30+ | 0 | 7 |
25-34 | 80-119 | 30+ | 0 | 2 |
25-34 | 120+ | 30+ | 0 | 2 |
35-44 | 0-39g/day | 30+ | 0 | 8 |
35-44 | 40-79 | 30+ | 0 | 8 |
35-44 | 80-119 | 30+ | 0 | 1 |
45-54 | 0-39g/day | 30+ | 0 | 4 |
45-54 | 40-79 | 30+ | 5 | 2 |
45-54 | 80-119 | 30+ | 2 | 2 |
45-54 | 120+ | 30+ | 4 | 0 |
55-64 | 0-39g/day | 30+ | 4 | 2 |
55-64 | 40-79 | 30+ | 3 | 3 |
55-64 | 80-119 | 30+ | 4 | 0 |
55-64 | 120+ | 30+ | 5 | 1 |
65-74 | 0-39g/day | 30+ | 0 | 2 |
65-74 | 80-119 | 30+ | 1 | 0 |
65-74 | 120+ | 30+ | 1 | 0 |
75+ | 0-39g/day | 30+ | 1 | 2 |
75+ | 40-79 | 30+ | 1 | 0 |
You can specify several conditions within a single
filter
function. If you have two conditions and want
both of them to apply, you can separate them using a
comma or the boolean ‘AND’ symbol which is the ampersand
&
.
If you have two conditions and want either of them
to apply you separate them using the boolean ‘OR’ symbol which is the
pipe |
(unfortunately this character has the same name as
the %>%
tool in R, but it would be read as ‘OR’).
Let’s filter the cancer dataset keeping cases where
ncases
is not equal to zero or
ncontrols
is greater than 20.
cancer %>%
filter(ncases != 0 | ncontrols > 20)
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 120+ | 10-19 | 1 | 0 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 |
35-44 | 0-39g/day | 10-19 | 1 | 13 |
35-44 | 40-79 | 0-9g/day | 0 | 35 |
35-44 | 40-79 | 10-19 | 3 | 20 |
35-44 | 40-79 | 20-29 | 1 | 13 |
35-44 | 120+ | 0-9g/day | 2 | 1 |
35-44 | 120+ | 20-29 | 2 | 2 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
45-54 | 40-79 | 10-19 | 4 | 17 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30+ | 5 | 2 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
45-54 | 80-119 | 10-19 | 6 | 8 |
45-54 | 80-119 | 20-29 | 1 | 4 |
45-54 | 80-119 | 30+ | 2 | 2 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
45-54 | 120+ | 20-29 | 2 | 1 |
45-54 | 120+ | 30+ | 4 | 0 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30+ | 4 | 2 |
55-64 | 40-79 | 0-9g/day | 9 | 31 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 20-29 | 4 | 13 |
55-64 | 40-79 | 30+ | 3 | 3 |
55-64 | 80-119 | 0-9g/day | 9 | 9 |
55-64 | 80-119 | 10-19 | 8 | 7 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30+ | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 10-19 | 6 | 1 |
55-64 | 120+ | 20-29 | 2 | 1 |
55-64 | 120+ | 30+ | 5 | 1 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 0-39g/day | 20-29 | 2 | 5 |
65-74 | 40-79 | 0-9g/day | 17 | 17 |
65-74 | 40-79 | 10-19 | 3 | 7 |
65-74 | 40-79 | 20-29 | 5 | 4 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
65-74 | 80-119 | 10-19 | 4 | 8 |
65-74 | 80-119 | 20-29 | 2 | 1 |
65-74 | 80-119 | 30+ | 1 | 0 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
65-74 | 120+ | 10-19 | 1 | 1 |
65-74 | 120+ | 20-29 | 1 | 0 |
65-74 | 120+ | 30+ | 1 | 0 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
75+ | 0-39g/day | 30+ | 1 | 2 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 30+ | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
75+ | 120+ | 0-9g/day | 2 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
What if we want to filter cases where a variable matches one of a
selection of different values? Using multiple OR statements would become
messy after about 3 options. A better way is to use the value matching
tool %in%
. The format is
x %in% c(a, b, c, ... )
where c(a, b, c, ... )
is a vector of options which are the same type as the variable
x
. Let’s filter the cancer dataset keeping only the rows
where ncases
in equal to 3, 4, 5 or 6.
cancer %>%
filter(ncases %in% c(3,4,5,6))
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
35-44 | 40-79 | 10-19 | 3 | 20 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
45-54 | 40-79 | 10-19 | 4 | 17 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30+ | 5 | 2 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
45-54 | 80-119 | 10-19 | 6 | 8 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
45-54 | 120+ | 30+ | 4 | 0 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30+ | 4 | 2 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 20-29 | 4 | 13 |
55-64 | 40-79 | 30+ | 3 | 3 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30+ | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 10-19 | 6 | 1 |
55-64 | 120+ | 30+ | 5 | 1 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 40-79 | 10-19 | 3 | 7 |
65-74 | 40-79 | 20-29 | 5 | 4 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
65-74 | 80-119 | 10-19 | 4 | 8 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
Note that since these four options are consecutive integers, we could
have written the vector simply as 3:6
, so an equivalent
piece of code would be:
cancer %>%
filter(ncases %in% 3:6)
The mutate
function is used to edit variables or to
create new ones. Let’s take the cancer
dataset and create a
new variable called new_var
which is just equal to
ncases
plus 5.
cancer %>%
mutate(new_var = ncases + 5)
agegp | alcgp | tobgp | ncases | ncontrols | new_var |
---|---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 | 5 |
25-34 | 0-39g/day | 10-19 | 0 | 10 | 5 |
25-34 | 0-39g/day | 20-29 | 0 | 6 | 5 |
25-34 | 0-39g/day | 30+ | 0 | 5 | 5 |
25-34 | 40-79 | 0-9g/day | 0 | 27 | 5 |
25-34 | 40-79 | 10-19 | 0 | 7 | 5 |
25-34 | 40-79 | 20-29 | 0 | 4 | 5 |
25-34 | 40-79 | 30+ | 0 | 7 | 5 |
25-34 | 80-119 | 0-9g/day | 0 | 2 | 5 |
25-34 | 80-119 | 10-19 | 0 | 1 | 5 |
25-34 | 80-119 | 30+ | 0 | 2 | 5 |
25-34 | 120+ | 0-9g/day | 0 | 1 | 5 |
25-34 | 120+ | 10-19 | 1 | 0 | 6 |
25-34 | 120+ | 20-29 | 0 | 1 | 5 |
25-34 | 120+ | 30+ | 0 | 2 | 5 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 | 5 |
35-44 | 0-39g/day | 10-19 | 1 | 13 | 6 |
35-44 | 0-39g/day | 20-29 | 0 | 7 | 5 |
35-44 | 0-39g/day | 30+ | 0 | 8 | 5 |
35-44 | 40-79 | 0-9g/day | 0 | 35 | 5 |
35-44 | 40-79 | 10-19 | 3 | 20 | 8 |
35-44 | 40-79 | 20-29 | 1 | 13 | 6 |
35-44 | 40-79 | 30+ | 0 | 8 | 5 |
35-44 | 80-119 | 0-9g/day | 0 | 11 | 5 |
35-44 | 80-119 | 10-19 | 0 | 6 | 5 |
35-44 | 80-119 | 20-29 | 0 | 2 | 5 |
35-44 | 80-119 | 30+ | 0 | 1 | 5 |
35-44 | 120+ | 0-9g/day | 2 | 1 | 7 |
35-44 | 120+ | 10-19 | 0 | 3 | 5 |
35-44 | 120+ | 20-29 | 2 | 2 | 7 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 | 6 |
45-54 | 0-39g/day | 10-19 | 0 | 18 | 5 |
45-54 | 0-39g/day | 20-29 | 0 | 10 | 5 |
45-54 | 0-39g/day | 30+ | 0 | 4 | 5 |
45-54 | 40-79 | 0-9g/day | 6 | 32 | 11 |
45-54 | 40-79 | 10-19 | 4 | 17 | 9 |
45-54 | 40-79 | 20-29 | 5 | 10 | 10 |
45-54 | 40-79 | 30+ | 5 | 2 | 10 |
45-54 | 80-119 | 0-9g/day | 3 | 13 | 8 |
45-54 | 80-119 | 10-19 | 6 | 8 | 11 |
45-54 | 80-119 | 20-29 | 1 | 4 | 6 |
45-54 | 80-119 | 30+ | 2 | 2 | 7 |
45-54 | 120+ | 0-9g/day | 4 | 0 | 9 |
45-54 | 120+ | 10-19 | 3 | 1 | 8 |
45-54 | 120+ | 20-29 | 2 | 1 | 7 |
45-54 | 120+ | 30+ | 4 | 0 | 9 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 | 7 |
55-64 | 0-39g/day | 10-19 | 3 | 19 | 8 |
55-64 | 0-39g/day | 20-29 | 3 | 9 | 8 |
55-64 | 0-39g/day | 30+ | 4 | 2 | 9 |
55-64 | 40-79 | 0-9g/day | 9 | 31 | 14 |
55-64 | 40-79 | 10-19 | 6 | 15 | 11 |
55-64 | 40-79 | 20-29 | 4 | 13 | 9 |
55-64 | 40-79 | 30+ | 3 | 3 | 8 |
55-64 | 80-119 | 0-9g/day | 9 | 9 | 14 |
55-64 | 80-119 | 10-19 | 8 | 7 | 13 |
55-64 | 80-119 | 20-29 | 3 | 3 | 8 |
55-64 | 80-119 | 30+ | 4 | 0 | 9 |
55-64 | 120+ | 0-9g/day | 5 | 5 | 10 |
55-64 | 120+ | 10-19 | 6 | 1 | 11 |
55-64 | 120+ | 20-29 | 2 | 1 | 7 |
55-64 | 120+ | 30+ | 5 | 1 | 10 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 | 10 |
65-74 | 0-39g/day | 10-19 | 4 | 10 | 9 |
65-74 | 0-39g/day | 20-29 | 2 | 5 | 7 |
65-74 | 0-39g/day | 30+ | 0 | 2 | 5 |
65-74 | 40-79 | 0-9g/day | 17 | 17 | 22 |
65-74 | 40-79 | 10-19 | 3 | 7 | 8 |
65-74 | 40-79 | 20-29 | 5 | 4 | 10 |
65-74 | 80-119 | 0-9g/day | 6 | 7 | 11 |
65-74 | 80-119 | 10-19 | 4 | 8 | 9 |
65-74 | 80-119 | 20-29 | 2 | 1 | 7 |
65-74 | 80-119 | 30+ | 1 | 0 | 6 |
65-74 | 120+ | 0-9g/day | 3 | 1 | 8 |
65-74 | 120+ | 10-19 | 1 | 1 | 6 |
65-74 | 120+ | 20-29 | 1 | 0 | 6 |
65-74 | 120+ | 30+ | 1 | 0 | 6 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 | 6 |
75+ | 0-39g/day | 10-19 | 2 | 4 | 7 |
75+ | 0-39g/day | 30+ | 1 | 2 | 6 |
75+ | 40-79 | 0-9g/day | 2 | 3 | 7 |
75+ | 40-79 | 10-19 | 1 | 2 | 6 |
75+ | 40-79 | 20-29 | 0 | 3 | 5 |
75+ | 40-79 | 30+ | 1 | 0 | 6 |
75+ | 80-119 | 0-9g/day | 1 | 0 | 6 |
75+ | 80-119 | 10-19 | 1 | 0 | 6 |
75+ | 120+ | 0-9g/day | 2 | 0 | 7 |
75+ | 120+ | 10-19 | 1 | 0 | 6 |
We can create a variable whose value is conditional on another
variable using if_else
. This function takes a logical
expression as its first argument, and then its second and third
arguments provide the result if the expression is true or false
respectively. Let’s make a variable called lots_of_controls
which is "Y"
if ncontrols
is greater than 15,
and "N"
otherwise. We’ll begin by selecting just the column
ncontrols
to make the output easier to read.
cancer %>%
select(ncontrols) %>%
mutate(lots_of_controls = if_else(ncontrols > 15 , "Y" , "N"))
ncontrols | lots_of_controls |
---|---|
40 | Y |
10 | N |
6 | N |
5 | N |
27 | Y |
7 | N |
4 | N |
7 | N |
2 | N |
1 | N |
2 | N |
1 | N |
0 | N |
1 | N |
2 | N |
60 | Y |
13 | N |
7 | N |
8 | N |
35 | Y |
20 | Y |
13 | N |
8 | N |
11 | N |
6 | N |
2 | N |
1 | N |
1 | N |
3 | N |
2 | N |
45 | Y |
18 | Y |
10 | N |
4 | N |
32 | Y |
17 | Y |
10 | N |
2 | N |
13 | N |
8 | N |
4 | N |
2 | N |
0 | N |
1 | N |
1 | N |
0 | N |
47 | Y |
19 | Y |
9 | N |
2 | N |
31 | Y |
15 | N |
13 | N |
3 | N |
9 | N |
7 | N |
3 | N |
0 | N |
5 | N |
1 | N |
1 | N |
1 | N |
43 | Y |
10 | N |
5 | N |
2 | N |
17 | Y |
7 | N |
4 | N |
7 | N |
8 | N |
1 | N |
0 | N |
1 | N |
1 | N |
0 | N |
0 | N |
17 | Y |
4 | N |
2 | N |
3 | N |
2 | N |
3 | N |
0 | N |
0 | N |
0 | N |
0 | N |
0 | N |
Suppose you wanted to change the variable tobgp
so that
instead of having 30+
it would read
30 or more
. If tobgp
was a regular string
variable, you could use the following. Note that the ‘false’ option (the
third argument to if_else
) is simply tobgp
,
meaning that tobgp
is left as-is if the logical expression
is false. This is a common structure, at least for me.
cancer %>%
mutate(tobgp = if_else(tobgp == "30+" , "30 or more" , tobgp))
However, if you try to run that piece of code you’ll get an error,
and this is because tobgp
is a factor with defined levels,
and "30 or more"
is not one of those levels.
There are two options here. The first is to change the variable
tobgp
into a regular character variable using
mutate
with as.character
, and then do the
switcheroo.
cancer %>%
mutate(tobgp = as.character(tobgp)) %>%
mutate(tobgp = if_else(tobgp == "30+" , "30 or more" , tobgp))
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 0-39g/day | 10-19 | 0 | 10 |
25-34 | 0-39g/day | 20-29 | 0 | 6 |
25-34 | 0-39g/day | 30 or more | 0 | 5 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 40-79 | 10-19 | 0 | 7 |
25-34 | 40-79 | 20-29 | 0 | 4 |
25-34 | 40-79 | 30 or more | 0 | 7 |
25-34 | 80-119 | 0-9g/day | 0 | 2 |
25-34 | 80-119 | 10-19 | 0 | 1 |
25-34 | 80-119 | 30 or more | 0 | 2 |
25-34 | 120+ | 0-9g/day | 0 | 1 |
25-34 | 120+ | 10-19 | 1 | 0 |
25-34 | 120+ | 20-29 | 0 | 1 |
25-34 | 120+ | 30 or more | 0 | 2 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 |
35-44 | 0-39g/day | 10-19 | 1 | 13 |
35-44 | 0-39g/day | 20-29 | 0 | 7 |
35-44 | 0-39g/day | 30 or more | 0 | 8 |
35-44 | 40-79 | 0-9g/day | 0 | 35 |
35-44 | 40-79 | 10-19 | 3 | 20 |
35-44 | 40-79 | 20-29 | 1 | 13 |
35-44 | 40-79 | 30 or more | 0 | 8 |
35-44 | 80-119 | 0-9g/day | 0 | 11 |
35-44 | 80-119 | 10-19 | 0 | 6 |
35-44 | 80-119 | 20-29 | 0 | 2 |
35-44 | 80-119 | 30 or more | 0 | 1 |
35-44 | 120+ | 0-9g/day | 2 | 1 |
35-44 | 120+ | 10-19 | 0 | 3 |
35-44 | 120+ | 20-29 | 2 | 2 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 |
45-54 | 0-39g/day | 10-19 | 0 | 18 |
45-54 | 0-39g/day | 20-29 | 0 | 10 |
45-54 | 0-39g/day | 30 or more | 0 | 4 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
45-54 | 40-79 | 10-19 | 4 | 17 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30 or more | 5 | 2 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
45-54 | 80-119 | 10-19 | 6 | 8 |
45-54 | 80-119 | 20-29 | 1 | 4 |
45-54 | 80-119 | 30 or more | 2 | 2 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
45-54 | 120+ | 20-29 | 2 | 1 |
45-54 | 120+ | 30 or more | 4 | 0 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30 or more | 4 | 2 |
55-64 | 40-79 | 0-9g/day | 9 | 31 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 20-29 | 4 | 13 |
55-64 | 40-79 | 30 or more | 3 | 3 |
55-64 | 80-119 | 0-9g/day | 9 | 9 |
55-64 | 80-119 | 10-19 | 8 | 7 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30 or more | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 10-19 | 6 | 1 |
55-64 | 120+ | 20-29 | 2 | 1 |
55-64 | 120+ | 30 or more | 5 | 1 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 0-39g/day | 20-29 | 2 | 5 |
65-74 | 0-39g/day | 30 or more | 0 | 2 |
65-74 | 40-79 | 0-9g/day | 17 | 17 |
65-74 | 40-79 | 10-19 | 3 | 7 |
65-74 | 40-79 | 20-29 | 5 | 4 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
65-74 | 80-119 | 10-19 | 4 | 8 |
65-74 | 80-119 | 20-29 | 2 | 1 |
65-74 | 80-119 | 30 or more | 1 | 0 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
65-74 | 120+ | 10-19 | 1 | 1 |
65-74 | 120+ | 20-29 | 1 | 0 |
65-74 | 120+ | 30 or more | 1 | 0 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
75+ | 0-39g/day | 30 or more | 1 | 2 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 20-29 | 0 | 3 |
75+ | 40-79 | 30 or more | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
75+ | 120+ | 0-9g/day | 2 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
That would work, but you would lose the ordered factor levels of
tobgp
which is useful for sorting. You could re-create the
factor again (not hard but beyond the scope of a crash course). A better
way might be to recode the level "30+"
in
the original factor using the function fct_recode
. Here’s
how you would do that:
cancer %>%
mutate(tobgp = fct_recode(tobgp , "30 or more" = "30+"))
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 0-39g/day | 10-19 | 0 | 10 |
25-34 | 0-39g/day | 20-29 | 0 | 6 |
25-34 | 0-39g/day | 30 or more | 0 | 5 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 40-79 | 10-19 | 0 | 7 |
25-34 | 40-79 | 20-29 | 0 | 4 |
25-34 | 40-79 | 30 or more | 0 | 7 |
25-34 | 80-119 | 0-9g/day | 0 | 2 |
25-34 | 80-119 | 10-19 | 0 | 1 |
25-34 | 80-119 | 30 or more | 0 | 2 |
25-34 | 120+ | 0-9g/day | 0 | 1 |
25-34 | 120+ | 10-19 | 1 | 0 |
25-34 | 120+ | 20-29 | 0 | 1 |
25-34 | 120+ | 30 or more | 0 | 2 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 |
35-44 | 0-39g/day | 10-19 | 1 | 13 |
35-44 | 0-39g/day | 20-29 | 0 | 7 |
35-44 | 0-39g/day | 30 or more | 0 | 8 |
35-44 | 40-79 | 0-9g/day | 0 | 35 |
35-44 | 40-79 | 10-19 | 3 | 20 |
35-44 | 40-79 | 20-29 | 1 | 13 |
35-44 | 40-79 | 30 or more | 0 | 8 |
35-44 | 80-119 | 0-9g/day | 0 | 11 |
35-44 | 80-119 | 10-19 | 0 | 6 |
35-44 | 80-119 | 20-29 | 0 | 2 |
35-44 | 80-119 | 30 or more | 0 | 1 |
35-44 | 120+ | 0-9g/day | 2 | 1 |
35-44 | 120+ | 10-19 | 0 | 3 |
35-44 | 120+ | 20-29 | 2 | 2 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 |
45-54 | 0-39g/day | 10-19 | 0 | 18 |
45-54 | 0-39g/day | 20-29 | 0 | 10 |
45-54 | 0-39g/day | 30 or more | 0 | 4 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
45-54 | 40-79 | 10-19 | 4 | 17 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30 or more | 5 | 2 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
45-54 | 80-119 | 10-19 | 6 | 8 |
45-54 | 80-119 | 20-29 | 1 | 4 |
45-54 | 80-119 | 30 or more | 2 | 2 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
45-54 | 120+ | 20-29 | 2 | 1 |
45-54 | 120+ | 30 or more | 4 | 0 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30 or more | 4 | 2 |
55-64 | 40-79 | 0-9g/day | 9 | 31 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 20-29 | 4 | 13 |
55-64 | 40-79 | 30 or more | 3 | 3 |
55-64 | 80-119 | 0-9g/day | 9 | 9 |
55-64 | 80-119 | 10-19 | 8 | 7 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30 or more | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 10-19 | 6 | 1 |
55-64 | 120+ | 20-29 | 2 | 1 |
55-64 | 120+ | 30 or more | 5 | 1 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 0-39g/day | 20-29 | 2 | 5 |
65-74 | 0-39g/day | 30 or more | 0 | 2 |
65-74 | 40-79 | 0-9g/day | 17 | 17 |
65-74 | 40-79 | 10-19 | 3 | 7 |
65-74 | 40-79 | 20-29 | 5 | 4 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
65-74 | 80-119 | 10-19 | 4 | 8 |
65-74 | 80-119 | 20-29 | 2 | 1 |
65-74 | 80-119 | 30 or more | 1 | 0 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
65-74 | 120+ | 10-19 | 1 | 1 |
65-74 | 120+ | 20-29 | 1 | 0 |
65-74 | 120+ | 30 or more | 1 | 0 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
75+ | 0-39g/day | 30 or more | 1 | 2 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 20-29 | 0 | 3 |
75+ | 40-79 | 30 or more | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
75+ | 120+ | 0-9g/day | 2 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
The function case_when
provides even greater
(potentially unlimited) options for conditionally defining a value. The
format for this function is a logical expression (condition) followed by
a tilde (~
) followed by the value to be assigned in the
event of that expression being true. This is repeated for further
conditions, with each option separated by a comma, and usually written
on separate lines for ease of reading. Below is an example where
amount_of_controls
has a value of "very few"
if ncontrols
is less than 10, "a couple"
if
ncontrols
is between 10 and 19, and "lots"
for
ncontrols
equal to 20 or more.
cancer %>%
select(ncontrols) %>%
mutate(amount_of_controls = case_when(
ncontrols < 10 ~ "very few",
ncontrols < 20 ~ "a couple",
ncontrols >= 20 ~ "lots"
))
ncontrols | amount_of_controls |
---|---|
40 | lots |
10 | a couple |
6 | very few |
5 | very few |
27 | lots |
7 | very few |
4 | very few |
7 | very few |
2 | very few |
1 | very few |
2 | very few |
1 | very few |
0 | very few |
1 | very few |
2 | very few |
60 | lots |
13 | a couple |
7 | very few |
8 | very few |
35 | lots |
20 | lots |
13 | a couple |
8 | very few |
11 | a couple |
6 | very few |
2 | very few |
1 | very few |
1 | very few |
3 | very few |
2 | very few |
45 | lots |
18 | a couple |
10 | a couple |
4 | very few |
32 | lots |
17 | a couple |
10 | a couple |
2 | very few |
13 | a couple |
8 | very few |
4 | very few |
2 | very few |
0 | very few |
1 | very few |
1 | very few |
0 | very few |
47 | lots |
19 | a couple |
9 | very few |
2 | very few |
31 | lots |
15 | a couple |
13 | a couple |
3 | very few |
9 | very few |
7 | very few |
3 | very few |
0 | very few |
5 | very few |
1 | very few |
1 | very few |
1 | very few |
43 | lots |
10 | a couple |
5 | very few |
2 | very few |
17 | a couple |
7 | very few |
4 | very few |
7 | very few |
8 | very few |
1 | very few |
0 | very few |
1 | very few |
1 | very few |
0 | very few |
0 | very few |
17 | a couple |
4 | very few |
2 | very few |
3 | very few |
2 | very few |
3 | very few |
0 | very few |
0 | very few |
0 | very few |
0 | very few |
0 | very few |
Note that the value returned by case_when
is determined
by the first true expression. This means that for the
second condition we don’t have to specify that ncontrols
is
greater or equal to 10, we write ncontrols < 20
rather
than ncontrols >=10 & ncontrols < 20
. This is
because the possibility that is ncontrols
is less than 10
is already covered off by the first expression. If
ncontrols
was equal to 5, for example, it would never make
it past the first condition into the second condition.
For the third expression (ncontrols >= 20
) it
shouldn’t have been necessary to specify any logical expression at all,
since all cases remaining after the first two
expressions would be greater than 20 by default and should be
categorised as "lots"
. We can therefore replace
ncontrols >= 20
with the word TRUE
and get
the same result (output not shown but identical to the above).
cancer %>%
select(ncontrols) %>%
mutate(amount_of_controls = case_when(
ncontrols < 10 ~ "very few",
ncontrols < 20 ~ "a couple",
TRUE ~ "lots"
))
Before we move on from mutate
I want to mention a couple
of other useful functions because these will be useful later. We can
create a variable equal to the minimum, maximum or sum of another
variable using the functions min
, max
and
sum
. Let’s calculate the sum of ncases
as a
separate variable.
cancer %>%
mutate(total_cases = sum(ncases))
agegp | alcgp | tobgp | ncases | ncontrols | total_cases |
---|---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 | 200 |
25-34 | 0-39g/day | 10-19 | 0 | 10 | 200 |
25-34 | 0-39g/day | 20-29 | 0 | 6 | 200 |
25-34 | 0-39g/day | 30+ | 0 | 5 | 200 |
25-34 | 40-79 | 0-9g/day | 0 | 27 | 200 |
25-34 | 40-79 | 10-19 | 0 | 7 | 200 |
25-34 | 40-79 | 20-29 | 0 | 4 | 200 |
25-34 | 40-79 | 30+ | 0 | 7 | 200 |
25-34 | 80-119 | 0-9g/day | 0 | 2 | 200 |
25-34 | 80-119 | 10-19 | 0 | 1 | 200 |
25-34 | 80-119 | 30+ | 0 | 2 | 200 |
25-34 | 120+ | 0-9g/day | 0 | 1 | 200 |
25-34 | 120+ | 10-19 | 1 | 0 | 200 |
25-34 | 120+ | 20-29 | 0 | 1 | 200 |
25-34 | 120+ | 30+ | 0 | 2 | 200 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 | 200 |
35-44 | 0-39g/day | 10-19 | 1 | 13 | 200 |
35-44 | 0-39g/day | 20-29 | 0 | 7 | 200 |
35-44 | 0-39g/day | 30+ | 0 | 8 | 200 |
35-44 | 40-79 | 0-9g/day | 0 | 35 | 200 |
35-44 | 40-79 | 10-19 | 3 | 20 | 200 |
35-44 | 40-79 | 20-29 | 1 | 13 | 200 |
35-44 | 40-79 | 30+ | 0 | 8 | 200 |
35-44 | 80-119 | 0-9g/day | 0 | 11 | 200 |
35-44 | 80-119 | 10-19 | 0 | 6 | 200 |
35-44 | 80-119 | 20-29 | 0 | 2 | 200 |
35-44 | 80-119 | 30+ | 0 | 1 | 200 |
35-44 | 120+ | 0-9g/day | 2 | 1 | 200 |
35-44 | 120+ | 10-19 | 0 | 3 | 200 |
35-44 | 120+ | 20-29 | 2 | 2 | 200 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 | 200 |
45-54 | 0-39g/day | 10-19 | 0 | 18 | 200 |
45-54 | 0-39g/day | 20-29 | 0 | 10 | 200 |
45-54 | 0-39g/day | 30+ | 0 | 4 | 200 |
45-54 | 40-79 | 0-9g/day | 6 | 32 | 200 |
45-54 | 40-79 | 10-19 | 4 | 17 | 200 |
45-54 | 40-79 | 20-29 | 5 | 10 | 200 |
45-54 | 40-79 | 30+ | 5 | 2 | 200 |
45-54 | 80-119 | 0-9g/day | 3 | 13 | 200 |
45-54 | 80-119 | 10-19 | 6 | 8 | 200 |
45-54 | 80-119 | 20-29 | 1 | 4 | 200 |
45-54 | 80-119 | 30+ | 2 | 2 | 200 |
45-54 | 120+ | 0-9g/day | 4 | 0 | 200 |
45-54 | 120+ | 10-19 | 3 | 1 | 200 |
45-54 | 120+ | 20-29 | 2 | 1 | 200 |
45-54 | 120+ | 30+ | 4 | 0 | 200 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 | 200 |
55-64 | 0-39g/day | 10-19 | 3 | 19 | 200 |
55-64 | 0-39g/day | 20-29 | 3 | 9 | 200 |
55-64 | 0-39g/day | 30+ | 4 | 2 | 200 |
55-64 | 40-79 | 0-9g/day | 9 | 31 | 200 |
55-64 | 40-79 | 10-19 | 6 | 15 | 200 |
55-64 | 40-79 | 20-29 | 4 | 13 | 200 |
55-64 | 40-79 | 30+ | 3 | 3 | 200 |
55-64 | 80-119 | 0-9g/day | 9 | 9 | 200 |
55-64 | 80-119 | 10-19 | 8 | 7 | 200 |
55-64 | 80-119 | 20-29 | 3 | 3 | 200 |
55-64 | 80-119 | 30+ | 4 | 0 | 200 |
55-64 | 120+ | 0-9g/day | 5 | 5 | 200 |
55-64 | 120+ | 10-19 | 6 | 1 | 200 |
55-64 | 120+ | 20-29 | 2 | 1 | 200 |
55-64 | 120+ | 30+ | 5 | 1 | 200 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 | 200 |
65-74 | 0-39g/day | 10-19 | 4 | 10 | 200 |
65-74 | 0-39g/day | 20-29 | 2 | 5 | 200 |
65-74 | 0-39g/day | 30+ | 0 | 2 | 200 |
65-74 | 40-79 | 0-9g/day | 17 | 17 | 200 |
65-74 | 40-79 | 10-19 | 3 | 7 | 200 |
65-74 | 40-79 | 20-29 | 5 | 4 | 200 |
65-74 | 80-119 | 0-9g/day | 6 | 7 | 200 |
65-74 | 80-119 | 10-19 | 4 | 8 | 200 |
65-74 | 80-119 | 20-29 | 2 | 1 | 200 |
65-74 | 80-119 | 30+ | 1 | 0 | 200 |
65-74 | 120+ | 0-9g/day | 3 | 1 | 200 |
65-74 | 120+ | 10-19 | 1 | 1 | 200 |
65-74 | 120+ | 20-29 | 1 | 0 | 200 |
65-74 | 120+ | 30+ | 1 | 0 | 200 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 | 200 |
75+ | 0-39g/day | 10-19 | 2 | 4 | 200 |
75+ | 0-39g/day | 30+ | 1 | 2 | 200 |
75+ | 40-79 | 0-9g/day | 2 | 3 | 200 |
75+ | 40-79 | 10-19 | 1 | 2 | 200 |
75+ | 40-79 | 20-29 | 0 | 3 | 200 |
75+ | 40-79 | 30+ | 1 | 0 | 200 |
75+ | 80-119 | 0-9g/day | 1 | 0 | 200 |
75+ | 80-119 | 10-19 | 1 | 0 | 200 |
75+ | 120+ | 0-9g/day | 2 | 0 | 200 |
75+ | 120+ | 10-19 | 1 | 0 | 200 |
We can also create a variable equal to the row number using
row_number
. We’ll create my_id
using this
function. Finally we can get the number of entries in the group using
n()
. Let’s call this variable number_of_rows
.
We’ll create both of these variables at the same time. Note that you can
create multiple variables in a single mutate
function
(separated by commas). You can even create a new variable in a
mutate
function and create another variable which depends
on the first one within the same mutate
function.
We will see later that row_number
and n
are
pretty versatile functions.
cancer %>%
mutate(my_id = row_number() , number_of_rows = n())
agegp | alcgp | tobgp | ncases | ncontrols | my_id | number_of_rows |
---|---|---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 | 1 | 88 |
25-34 | 0-39g/day | 10-19 | 0 | 10 | 2 | 88 |
25-34 | 0-39g/day | 20-29 | 0 | 6 | 3 | 88 |
25-34 | 0-39g/day | 30+ | 0 | 5 | 4 | 88 |
25-34 | 40-79 | 0-9g/day | 0 | 27 | 5 | 88 |
25-34 | 40-79 | 10-19 | 0 | 7 | 6 | 88 |
25-34 | 40-79 | 20-29 | 0 | 4 | 7 | 88 |
25-34 | 40-79 | 30+ | 0 | 7 | 8 | 88 |
25-34 | 80-119 | 0-9g/day | 0 | 2 | 9 | 88 |
25-34 | 80-119 | 10-19 | 0 | 1 | 10 | 88 |
25-34 | 80-119 | 30+ | 0 | 2 | 11 | 88 |
25-34 | 120+ | 0-9g/day | 0 | 1 | 12 | 88 |
25-34 | 120+ | 10-19 | 1 | 0 | 13 | 88 |
25-34 | 120+ | 20-29 | 0 | 1 | 14 | 88 |
25-34 | 120+ | 30+ | 0 | 2 | 15 | 88 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 | 16 | 88 |
35-44 | 0-39g/day | 10-19 | 1 | 13 | 17 | 88 |
35-44 | 0-39g/day | 20-29 | 0 | 7 | 18 | 88 |
35-44 | 0-39g/day | 30+ | 0 | 8 | 19 | 88 |
35-44 | 40-79 | 0-9g/day | 0 | 35 | 20 | 88 |
35-44 | 40-79 | 10-19 | 3 | 20 | 21 | 88 |
35-44 | 40-79 | 20-29 | 1 | 13 | 22 | 88 |
35-44 | 40-79 | 30+ | 0 | 8 | 23 | 88 |
35-44 | 80-119 | 0-9g/day | 0 | 11 | 24 | 88 |
35-44 | 80-119 | 10-19 | 0 | 6 | 25 | 88 |
35-44 | 80-119 | 20-29 | 0 | 2 | 26 | 88 |
35-44 | 80-119 | 30+ | 0 | 1 | 27 | 88 |
35-44 | 120+ | 0-9g/day | 2 | 1 | 28 | 88 |
35-44 | 120+ | 10-19 | 0 | 3 | 29 | 88 |
35-44 | 120+ | 20-29 | 2 | 2 | 30 | 88 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 | 31 | 88 |
45-54 | 0-39g/day | 10-19 | 0 | 18 | 32 | 88 |
45-54 | 0-39g/day | 20-29 | 0 | 10 | 33 | 88 |
45-54 | 0-39g/day | 30+ | 0 | 4 | 34 | 88 |
45-54 | 40-79 | 0-9g/day | 6 | 32 | 35 | 88 |
45-54 | 40-79 | 10-19 | 4 | 17 | 36 | 88 |
45-54 | 40-79 | 20-29 | 5 | 10 | 37 | 88 |
45-54 | 40-79 | 30+ | 5 | 2 | 38 | 88 |
45-54 | 80-119 | 0-9g/day | 3 | 13 | 39 | 88 |
45-54 | 80-119 | 10-19 | 6 | 8 | 40 | 88 |
45-54 | 80-119 | 20-29 | 1 | 4 | 41 | 88 |
45-54 | 80-119 | 30+ | 2 | 2 | 42 | 88 |
45-54 | 120+ | 0-9g/day | 4 | 0 | 43 | 88 |
45-54 | 120+ | 10-19 | 3 | 1 | 44 | 88 |
45-54 | 120+ | 20-29 | 2 | 1 | 45 | 88 |
45-54 | 120+ | 30+ | 4 | 0 | 46 | 88 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 | 47 | 88 |
55-64 | 0-39g/day | 10-19 | 3 | 19 | 48 | 88 |
55-64 | 0-39g/day | 20-29 | 3 | 9 | 49 | 88 |
55-64 | 0-39g/day | 30+ | 4 | 2 | 50 | 88 |
55-64 | 40-79 | 0-9g/day | 9 | 31 | 51 | 88 |
55-64 | 40-79 | 10-19 | 6 | 15 | 52 | 88 |
55-64 | 40-79 | 20-29 | 4 | 13 | 53 | 88 |
55-64 | 40-79 | 30+ | 3 | 3 | 54 | 88 |
55-64 | 80-119 | 0-9g/day | 9 | 9 | 55 | 88 |
55-64 | 80-119 | 10-19 | 8 | 7 | 56 | 88 |
55-64 | 80-119 | 20-29 | 3 | 3 | 57 | 88 |
55-64 | 80-119 | 30+ | 4 | 0 | 58 | 88 |
55-64 | 120+ | 0-9g/day | 5 | 5 | 59 | 88 |
55-64 | 120+ | 10-19 | 6 | 1 | 60 | 88 |
55-64 | 120+ | 20-29 | 2 | 1 | 61 | 88 |
55-64 | 120+ | 30+ | 5 | 1 | 62 | 88 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 | 63 | 88 |
65-74 | 0-39g/day | 10-19 | 4 | 10 | 64 | 88 |
65-74 | 0-39g/day | 20-29 | 2 | 5 | 65 | 88 |
65-74 | 0-39g/day | 30+ | 0 | 2 | 66 | 88 |
65-74 | 40-79 | 0-9g/day | 17 | 17 | 67 | 88 |
65-74 | 40-79 | 10-19 | 3 | 7 | 68 | 88 |
65-74 | 40-79 | 20-29 | 5 | 4 | 69 | 88 |
65-74 | 80-119 | 0-9g/day | 6 | 7 | 70 | 88 |
65-74 | 80-119 | 10-19 | 4 | 8 | 71 | 88 |
65-74 | 80-119 | 20-29 | 2 | 1 | 72 | 88 |
65-74 | 80-119 | 30+ | 1 | 0 | 73 | 88 |
65-74 | 120+ | 0-9g/day | 3 | 1 | 74 | 88 |
65-74 | 120+ | 10-19 | 1 | 1 | 75 | 88 |
65-74 | 120+ | 20-29 | 1 | 0 | 76 | 88 |
65-74 | 120+ | 30+ | 1 | 0 | 77 | 88 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 | 78 | 88 |
75+ | 0-39g/day | 10-19 | 2 | 4 | 79 | 88 |
75+ | 0-39g/day | 30+ | 1 | 2 | 80 | 88 |
75+ | 40-79 | 0-9g/day | 2 | 3 | 81 | 88 |
75+ | 40-79 | 10-19 | 1 | 2 | 82 | 88 |
75+ | 40-79 | 20-29 | 0 | 3 | 83 | 88 |
75+ | 40-79 | 30+ | 1 | 0 | 84 | 88 |
75+ | 80-119 | 0-9g/day | 1 | 0 | 85 | 88 |
75+ | 80-119 | 10-19 | 1 | 0 | 86 | 88 |
75+ | 120+ | 0-9g/day | 2 | 0 | 87 | 88 |
75+ | 120+ | 10-19 | 1 | 0 | 88 | 88 |
The function summarise
is used to produce aggregated
data from a dataframe. In practice it is almost always used in
combination with summary functions such as max
,
sum
, etc.
Let’s calculate the sum of ncases
and
ncontrols
from the cancer dataset. We will also calculate
the number of rows in the dataset using the function
n()
.
cancer %>%
summarise(total_cases = sum(ncases) ,
total_controls = sum(ncontrols),
number_of_rows = n())
total_cases | total_controls | number_of_rows |
---|---|---|
200 | 775 | 88 |
Note that whereas mutate
added the new calculations as
additional rows, summarise
has done away with the original
data.
The real power of mutate
and summarise
becomes clear when you start to use them in combination with
group_by
. This function allows you to and calculate counts
and summary functions over groups within the data. With
mutate
the new grouped aggregated data is added to the
dataset, and with summarise
only the aggregated data for
each group remains.
Let’s calculate the total number of controls for each of the four
bands of tobacco intake (tobgp
) and add that as a new
column called total_controls
.
cancer %>%
group_by(tobgp) %>%
mutate(total_controls = sum(ncases))
agegp | alcgp | tobgp | ncases | ncontrols | total_controls |
---|---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 | 78 |
25-34 | 0-39g/day | 10-19 | 0 | 10 | 58 |
25-34 | 0-39g/day | 20-29 | 0 | 6 | 33 |
25-34 | 0-39g/day | 30+ | 0 | 5 | 31 |
25-34 | 40-79 | 0-9g/day | 0 | 27 | 78 |
25-34 | 40-79 | 10-19 | 0 | 7 | 58 |
25-34 | 40-79 | 20-29 | 0 | 4 | 33 |
25-34 | 40-79 | 30+ | 0 | 7 | 31 |
25-34 | 80-119 | 0-9g/day | 0 | 2 | 78 |
25-34 | 80-119 | 10-19 | 0 | 1 | 58 |
25-34 | 80-119 | 30+ | 0 | 2 | 31 |
25-34 | 120+ | 0-9g/day | 0 | 1 | 78 |
25-34 | 120+ | 10-19 | 1 | 0 | 58 |
25-34 | 120+ | 20-29 | 0 | 1 | 33 |
25-34 | 120+ | 30+ | 0 | 2 | 31 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 | 78 |
35-44 | 0-39g/day | 10-19 | 1 | 13 | 58 |
35-44 | 0-39g/day | 20-29 | 0 | 7 | 33 |
35-44 | 0-39g/day | 30+ | 0 | 8 | 31 |
35-44 | 40-79 | 0-9g/day | 0 | 35 | 78 |
35-44 | 40-79 | 10-19 | 3 | 20 | 58 |
35-44 | 40-79 | 20-29 | 1 | 13 | 33 |
35-44 | 40-79 | 30+ | 0 | 8 | 31 |
35-44 | 80-119 | 0-9g/day | 0 | 11 | 78 |
35-44 | 80-119 | 10-19 | 0 | 6 | 58 |
35-44 | 80-119 | 20-29 | 0 | 2 | 33 |
35-44 | 80-119 | 30+ | 0 | 1 | 31 |
35-44 | 120+ | 0-9g/day | 2 | 1 | 78 |
35-44 | 120+ | 10-19 | 0 | 3 | 58 |
35-44 | 120+ | 20-29 | 2 | 2 | 33 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 | 78 |
45-54 | 0-39g/day | 10-19 | 0 | 18 | 58 |
45-54 | 0-39g/day | 20-29 | 0 | 10 | 33 |
45-54 | 0-39g/day | 30+ | 0 | 4 | 31 |
45-54 | 40-79 | 0-9g/day | 6 | 32 | 78 |
45-54 | 40-79 | 10-19 | 4 | 17 | 58 |
45-54 | 40-79 | 20-29 | 5 | 10 | 33 |
45-54 | 40-79 | 30+ | 5 | 2 | 31 |
45-54 | 80-119 | 0-9g/day | 3 | 13 | 78 |
45-54 | 80-119 | 10-19 | 6 | 8 | 58 |
45-54 | 80-119 | 20-29 | 1 | 4 | 33 |
45-54 | 80-119 | 30+ | 2 | 2 | 31 |
45-54 | 120+ | 0-9g/day | 4 | 0 | 78 |
45-54 | 120+ | 10-19 | 3 | 1 | 58 |
45-54 | 120+ | 20-29 | 2 | 1 | 33 |
45-54 | 120+ | 30+ | 4 | 0 | 31 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 | 78 |
55-64 | 0-39g/day | 10-19 | 3 | 19 | 58 |
55-64 | 0-39g/day | 20-29 | 3 | 9 | 33 |
55-64 | 0-39g/day | 30+ | 4 | 2 | 31 |
55-64 | 40-79 | 0-9g/day | 9 | 31 | 78 |
55-64 | 40-79 | 10-19 | 6 | 15 | 58 |
55-64 | 40-79 | 20-29 | 4 | 13 | 33 |
55-64 | 40-79 | 30+ | 3 | 3 | 31 |
55-64 | 80-119 | 0-9g/day | 9 | 9 | 78 |
55-64 | 80-119 | 10-19 | 8 | 7 | 58 |
55-64 | 80-119 | 20-29 | 3 | 3 | 33 |
55-64 | 80-119 | 30+ | 4 | 0 | 31 |
55-64 | 120+ | 0-9g/day | 5 | 5 | 78 |
55-64 | 120+ | 10-19 | 6 | 1 | 58 |
55-64 | 120+ | 20-29 | 2 | 1 | 33 |
55-64 | 120+ | 30+ | 5 | 1 | 31 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 | 78 |
65-74 | 0-39g/day | 10-19 | 4 | 10 | 58 |
65-74 | 0-39g/day | 20-29 | 2 | 5 | 33 |
65-74 | 0-39g/day | 30+ | 0 | 2 | 31 |
65-74 | 40-79 | 0-9g/day | 17 | 17 | 78 |
65-74 | 40-79 | 10-19 | 3 | 7 | 58 |
65-74 | 40-79 | 20-29 | 5 | 4 | 33 |
65-74 | 80-119 | 0-9g/day | 6 | 7 | 78 |
65-74 | 80-119 | 10-19 | 4 | 8 | 58 |
65-74 | 80-119 | 20-29 | 2 | 1 | 33 |
65-74 | 80-119 | 30+ | 1 | 0 | 31 |
65-74 | 120+ | 0-9g/day | 3 | 1 | 78 |
65-74 | 120+ | 10-19 | 1 | 1 | 58 |
65-74 | 120+ | 20-29 | 1 | 0 | 33 |
65-74 | 120+ | 30+ | 1 | 0 | 31 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 | 78 |
75+ | 0-39g/day | 10-19 | 2 | 4 | 58 |
75+ | 0-39g/day | 30+ | 1 | 2 | 31 |
75+ | 40-79 | 0-9g/day | 2 | 3 | 78 |
75+ | 40-79 | 10-19 | 1 | 2 | 58 |
75+ | 40-79 | 20-29 | 0 | 3 | 33 |
75+ | 40-79 | 30+ | 1 | 0 | 31 |
75+ | 80-119 | 0-9g/day | 1 | 0 | 78 |
75+ | 80-119 | 10-19 | 1 | 0 | 58 |
75+ | 120+ | 0-9g/day | 2 | 0 | 78 |
75+ | 120+ | 10-19 | 1 | 0 | 58 |
The row number function can be used with group_by
to
produce a counter or unique number for each group. Here we’ll create a
counter called age_group_counter
for each value of
agegp
.
cancer %>%
group_by(agegp) %>%
mutate(age_group_counter = row_number())
agegp | alcgp | tobgp | ncases | ncontrols | age_group_counter |
---|---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 | 1 |
25-34 | 0-39g/day | 10-19 | 0 | 10 | 2 |
25-34 | 0-39g/day | 20-29 | 0 | 6 | 3 |
25-34 | 0-39g/day | 30+ | 0 | 5 | 4 |
25-34 | 40-79 | 0-9g/day | 0 | 27 | 5 |
25-34 | 40-79 | 10-19 | 0 | 7 | 6 |
25-34 | 40-79 | 20-29 | 0 | 4 | 7 |
25-34 | 40-79 | 30+ | 0 | 7 | 8 |
25-34 | 80-119 | 0-9g/day | 0 | 2 | 9 |
25-34 | 80-119 | 10-19 | 0 | 1 | 10 |
25-34 | 80-119 | 30+ | 0 | 2 | 11 |
25-34 | 120+ | 0-9g/day | 0 | 1 | 12 |
25-34 | 120+ | 10-19 | 1 | 0 | 13 |
25-34 | 120+ | 20-29 | 0 | 1 | 14 |
25-34 | 120+ | 30+ | 0 | 2 | 15 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 | 1 |
35-44 | 0-39g/day | 10-19 | 1 | 13 | 2 |
35-44 | 0-39g/day | 20-29 | 0 | 7 | 3 |
35-44 | 0-39g/day | 30+ | 0 | 8 | 4 |
35-44 | 40-79 | 0-9g/day | 0 | 35 | 5 |
35-44 | 40-79 | 10-19 | 3 | 20 | 6 |
35-44 | 40-79 | 20-29 | 1 | 13 | 7 |
35-44 | 40-79 | 30+ | 0 | 8 | 8 |
35-44 | 80-119 | 0-9g/day | 0 | 11 | 9 |
35-44 | 80-119 | 10-19 | 0 | 6 | 10 |
35-44 | 80-119 | 20-29 | 0 | 2 | 11 |
35-44 | 80-119 | 30+ | 0 | 1 | 12 |
35-44 | 120+ | 0-9g/day | 2 | 1 | 13 |
35-44 | 120+ | 10-19 | 0 | 3 | 14 |
35-44 | 120+ | 20-29 | 2 | 2 | 15 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 | 1 |
45-54 | 0-39g/day | 10-19 | 0 | 18 | 2 |
45-54 | 0-39g/day | 20-29 | 0 | 10 | 3 |
45-54 | 0-39g/day | 30+ | 0 | 4 | 4 |
45-54 | 40-79 | 0-9g/day | 6 | 32 | 5 |
45-54 | 40-79 | 10-19 | 4 | 17 | 6 |
45-54 | 40-79 | 20-29 | 5 | 10 | 7 |
45-54 | 40-79 | 30+ | 5 | 2 | 8 |
45-54 | 80-119 | 0-9g/day | 3 | 13 | 9 |
45-54 | 80-119 | 10-19 | 6 | 8 | 10 |
45-54 | 80-119 | 20-29 | 1 | 4 | 11 |
45-54 | 80-119 | 30+ | 2 | 2 | 12 |
45-54 | 120+ | 0-9g/day | 4 | 0 | 13 |
45-54 | 120+ | 10-19 | 3 | 1 | 14 |
45-54 | 120+ | 20-29 | 2 | 1 | 15 |
45-54 | 120+ | 30+ | 4 | 0 | 16 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 | 1 |
55-64 | 0-39g/day | 10-19 | 3 | 19 | 2 |
55-64 | 0-39g/day | 20-29 | 3 | 9 | 3 |
55-64 | 0-39g/day | 30+ | 4 | 2 | 4 |
55-64 | 40-79 | 0-9g/day | 9 | 31 | 5 |
55-64 | 40-79 | 10-19 | 6 | 15 | 6 |
55-64 | 40-79 | 20-29 | 4 | 13 | 7 |
55-64 | 40-79 | 30+ | 3 | 3 | 8 |
55-64 | 80-119 | 0-9g/day | 9 | 9 | 9 |
55-64 | 80-119 | 10-19 | 8 | 7 | 10 |
55-64 | 80-119 | 20-29 | 3 | 3 | 11 |
55-64 | 80-119 | 30+ | 4 | 0 | 12 |
55-64 | 120+ | 0-9g/day | 5 | 5 | 13 |
55-64 | 120+ | 10-19 | 6 | 1 | 14 |
55-64 | 120+ | 20-29 | 2 | 1 | 15 |
55-64 | 120+ | 30+ | 5 | 1 | 16 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 | 1 |
65-74 | 0-39g/day | 10-19 | 4 | 10 | 2 |
65-74 | 0-39g/day | 20-29 | 2 | 5 | 3 |
65-74 | 0-39g/day | 30+ | 0 | 2 | 4 |
65-74 | 40-79 | 0-9g/day | 17 | 17 | 5 |
65-74 | 40-79 | 10-19 | 3 | 7 | 6 |
65-74 | 40-79 | 20-29 | 5 | 4 | 7 |
65-74 | 80-119 | 0-9g/day | 6 | 7 | 8 |
65-74 | 80-119 | 10-19 | 4 | 8 | 9 |
65-74 | 80-119 | 20-29 | 2 | 1 | 10 |
65-74 | 80-119 | 30+ | 1 | 0 | 11 |
65-74 | 120+ | 0-9g/day | 3 | 1 | 12 |
65-74 | 120+ | 10-19 | 1 | 1 | 13 |
65-74 | 120+ | 20-29 | 1 | 0 | 14 |
65-74 | 120+ | 30+ | 1 | 0 | 15 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 | 1 |
75+ | 0-39g/day | 10-19 | 2 | 4 | 2 |
75+ | 0-39g/day | 30+ | 1 | 2 | 3 |
75+ | 40-79 | 0-9g/day | 2 | 3 | 4 |
75+ | 40-79 | 10-19 | 1 | 2 | 5 |
75+ | 40-79 | 20-29 | 0 | 3 | 6 |
75+ | 40-79 | 30+ | 1 | 0 | 7 |
75+ | 80-119 | 0-9g/day | 1 | 0 | 8 |
75+ | 80-119 | 10-19 | 1 | 0 | 9 |
75+ | 120+ | 0-9g/day | 2 | 0 | 10 |
75+ | 120+ | 10-19 | 1 | 0 | 11 |
Let’s get the total number of cases by age group (agegp
)
and tobacco intake group (tobgp
).
Note that we group by two variables using a single
group_by
statement. If we use a second
group_by
it will overwrite the previous grouping, the
function is not ‘additive’ in that way.
cancer %>%
group_by(agegp, tobgp) %>%
summarise(total_cases = sum(ncases))
agegp | tobgp | total_cases |
---|---|---|
25-34 | 0-9g/day | 0 |
25-34 | 10-19 | 1 |
25-34 | 20-29 | 0 |
25-34 | 30+ | 0 |
35-44 | 0-9g/day | 2 |
35-44 | 10-19 | 4 |
35-44 | 20-29 | 3 |
35-44 | 30+ | 0 |
45-54 | 0-9g/day | 14 |
45-54 | 10-19 | 13 |
45-54 | 20-29 | 8 |
45-54 | 30+ | 11 |
55-64 | 0-9g/day | 25 |
55-64 | 10-19 | 23 |
55-64 | 20-29 | 12 |
55-64 | 30+ | 16 |
65-74 | 0-9g/day | 31 |
65-74 | 10-19 | 12 |
65-74 | 20-29 | 10 |
65-74 | 30+ | 2 |
75+ | 0-9g/day | 6 |
75+ | 10-19 | 5 |
75+ | 20-29 | 0 |
75+ | 30+ | 2 |
After using a group_by
you may wish to apply the
function ungroup()
. This could avoid unexpected outcomes
later, for example if you were using a summary function on a dataset
that you had grouped for the purposes of some mutate
process. Here’s how you would use it (results not shown):
cancer %>%
group_by(tobgp) %>%
mutate(total_controls = sum(ncases)) %>%
ungroup()
You will probably need to rename variables at some stage. We use the
rename
function to do that. This is another tidyverse
function, so its first argument is the dataframe to be edited and
therefore it can be used with the pipe. You can rename more than one
variable in a single rename
function. Let’s take the cancer
dataset and rename the variable agegp
as
age_group
, and alcgp
as
alcohol_group
. Note that the order of the variable names in
this function is new_name = old_name
.
cancer %>%
rename(age_group = agegp , alcohol_group = alcgp)
age_group | alcohol_group | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 0-39g/day | 10-19 | 0 | 10 |
25-34 | 0-39g/day | 20-29 | 0 | 6 |
25-34 | 0-39g/day | 30+ | 0 | 5 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 40-79 | 10-19 | 0 | 7 |
25-34 | 40-79 | 20-29 | 0 | 4 |
25-34 | 40-79 | 30+ | 0 | 7 |
25-34 | 80-119 | 0-9g/day | 0 | 2 |
25-34 | 80-119 | 10-19 | 0 | 1 |
25-34 | 80-119 | 30+ | 0 | 2 |
25-34 | 120+ | 0-9g/day | 0 | 1 |
25-34 | 120+ | 10-19 | 1 | 0 |
25-34 | 120+ | 20-29 | 0 | 1 |
25-34 | 120+ | 30+ | 0 | 2 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 |
35-44 | 0-39g/day | 10-19 | 1 | 13 |
35-44 | 0-39g/day | 20-29 | 0 | 7 |
35-44 | 0-39g/day | 30+ | 0 | 8 |
35-44 | 40-79 | 0-9g/day | 0 | 35 |
35-44 | 40-79 | 10-19 | 3 | 20 |
35-44 | 40-79 | 20-29 | 1 | 13 |
35-44 | 40-79 | 30+ | 0 | 8 |
35-44 | 80-119 | 0-9g/day | 0 | 11 |
35-44 | 80-119 | 10-19 | 0 | 6 |
35-44 | 80-119 | 20-29 | 0 | 2 |
35-44 | 80-119 | 30+ | 0 | 1 |
35-44 | 120+ | 0-9g/day | 2 | 1 |
35-44 | 120+ | 10-19 | 0 | 3 |
35-44 | 120+ | 20-29 | 2 | 2 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 |
45-54 | 0-39g/day | 10-19 | 0 | 18 |
45-54 | 0-39g/day | 20-29 | 0 | 10 |
45-54 | 0-39g/day | 30+ | 0 | 4 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
45-54 | 40-79 | 10-19 | 4 | 17 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30+ | 5 | 2 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
45-54 | 80-119 | 10-19 | 6 | 8 |
45-54 | 80-119 | 20-29 | 1 | 4 |
45-54 | 80-119 | 30+ | 2 | 2 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
45-54 | 120+ | 20-29 | 2 | 1 |
45-54 | 120+ | 30+ | 4 | 0 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30+ | 4 | 2 |
55-64 | 40-79 | 0-9g/day | 9 | 31 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 20-29 | 4 | 13 |
55-64 | 40-79 | 30+ | 3 | 3 |
55-64 | 80-119 | 0-9g/day | 9 | 9 |
55-64 | 80-119 | 10-19 | 8 | 7 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30+ | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 10-19 | 6 | 1 |
55-64 | 120+ | 20-29 | 2 | 1 |
55-64 | 120+ | 30+ | 5 | 1 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 0-39g/day | 20-29 | 2 | 5 |
65-74 | 0-39g/day | 30+ | 0 | 2 |
65-74 | 40-79 | 0-9g/day | 17 | 17 |
65-74 | 40-79 | 10-19 | 3 | 7 |
65-74 | 40-79 | 20-29 | 5 | 4 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
65-74 | 80-119 | 10-19 | 4 | 8 |
65-74 | 80-119 | 20-29 | 2 | 1 |
65-74 | 80-119 | 30+ | 1 | 0 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
65-74 | 120+ | 10-19 | 1 | 1 |
65-74 | 120+ | 20-29 | 1 | 0 |
65-74 | 120+ | 30+ | 1 | 0 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
75+ | 0-39g/day | 30+ | 1 | 2 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 20-29 | 0 | 3 |
75+ | 40-79 | 30+ | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
75+ | 120+ | 0-9g/day | 2 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
You can sort datasets using the function arrange
. This
is another tidyverse function so has the dataframe as the first argument
and is pipe-friendly. You can sort by as many variables as you like.
Let’s sort the cancer dataset by alcgp
and then by
ncases
. Note that since alcgp
is an ordered
factor (ordinal variable), it is sorted according to the order of the
levels rather than alphabetically.
cancer %>%
arrange(alcgp, ncases)
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 0-39g/day | 10-19 | 0 | 10 |
25-34 | 0-39g/day | 20-29 | 0 | 6 |
25-34 | 0-39g/day | 30+ | 0 | 5 |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 |
35-44 | 0-39g/day | 20-29 | 0 | 7 |
35-44 | 0-39g/day | 30+ | 0 | 8 |
45-54 | 0-39g/day | 10-19 | 0 | 18 |
45-54 | 0-39g/day | 20-29 | 0 | 10 |
45-54 | 0-39g/day | 30+ | 0 | 4 |
65-74 | 0-39g/day | 30+ | 0 | 2 |
35-44 | 0-39g/day | 10-19 | 1 | 13 |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 30+ | 1 | 2 |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 |
65-74 | 0-39g/day | 20-29 | 2 | 5 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
55-64 | 0-39g/day | 10-19 | 3 | 19 |
55-64 | 0-39g/day | 20-29 | 3 | 9 |
55-64 | 0-39g/day | 30+ | 4 | 2 |
65-74 | 0-39g/day | 10-19 | 4 | 10 |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 40-79 | 10-19 | 0 | 7 |
25-34 | 40-79 | 20-29 | 0 | 4 |
25-34 | 40-79 | 30+ | 0 | 7 |
35-44 | 40-79 | 0-9g/day | 0 | 35 |
35-44 | 40-79 | 30+ | 0 | 8 |
75+ | 40-79 | 20-29 | 0 | 3 |
35-44 | 40-79 | 20-29 | 1 | 13 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 30+ | 1 | 0 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
35-44 | 40-79 | 10-19 | 3 | 20 |
55-64 | 40-79 | 30+ | 3 | 3 |
65-74 | 40-79 | 10-19 | 3 | 7 |
45-54 | 40-79 | 10-19 | 4 | 17 |
55-64 | 40-79 | 20-29 | 4 | 13 |
45-54 | 40-79 | 20-29 | 5 | 10 |
45-54 | 40-79 | 30+ | 5 | 2 |
65-74 | 40-79 | 20-29 | 5 | 4 |
45-54 | 40-79 | 0-9g/day | 6 | 32 |
55-64 | 40-79 | 10-19 | 6 | 15 |
55-64 | 40-79 | 0-9g/day | 9 | 31 |
65-74 | 40-79 | 0-9g/day | 17 | 17 |
25-34 | 80-119 | 0-9g/day | 0 | 2 |
25-34 | 80-119 | 10-19 | 0 | 1 |
25-34 | 80-119 | 30+ | 0 | 2 |
35-44 | 80-119 | 0-9g/day | 0 | 11 |
35-44 | 80-119 | 10-19 | 0 | 6 |
35-44 | 80-119 | 20-29 | 0 | 2 |
35-44 | 80-119 | 30+ | 0 | 1 |
45-54 | 80-119 | 20-29 | 1 | 4 |
65-74 | 80-119 | 30+ | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
45-54 | 80-119 | 30+ | 2 | 2 |
65-74 | 80-119 | 20-29 | 2 | 1 |
45-54 | 80-119 | 0-9g/day | 3 | 13 |
55-64 | 80-119 | 20-29 | 3 | 3 |
55-64 | 80-119 | 30+ | 4 | 0 |
65-74 | 80-119 | 10-19 | 4 | 8 |
45-54 | 80-119 | 10-19 | 6 | 8 |
65-74 | 80-119 | 0-9g/day | 6 | 7 |
55-64 | 80-119 | 10-19 | 8 | 7 |
55-64 | 80-119 | 0-9g/day | 9 | 9 |
25-34 | 120+ | 0-9g/day | 0 | 1 |
25-34 | 120+ | 20-29 | 0 | 1 |
25-34 | 120+ | 30+ | 0 | 2 |
35-44 | 120+ | 10-19 | 0 | 3 |
25-34 | 120+ | 10-19 | 1 | 0 |
65-74 | 120+ | 10-19 | 1 | 1 |
65-74 | 120+ | 20-29 | 1 | 0 |
65-74 | 120+ | 30+ | 1 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
35-44 | 120+ | 0-9g/day | 2 | 1 |
35-44 | 120+ | 20-29 | 2 | 2 |
45-54 | 120+ | 20-29 | 2 | 1 |
55-64 | 120+ | 20-29 | 2 | 1 |
75+ | 120+ | 0-9g/day | 2 | 0 |
45-54 | 120+ | 10-19 | 3 | 1 |
65-74 | 120+ | 0-9g/day | 3 | 1 |
45-54 | 120+ | 0-9g/day | 4 | 0 |
45-54 | 120+ | 30+ | 4 | 0 |
55-64 | 120+ | 0-9g/day | 5 | 5 |
55-64 | 120+ | 30+ | 5 | 1 |
55-64 | 120+ | 10-19 | 6 | 1 |
You will probably need to join datasets together by some common id or
other variable. We don’t have anything to join onto the cancer dataset
yet, so let’s make a dataframe called ‘data_set_to_join’. It has one
variable in common with the cancer dataset which is tobgp
,
however it has one extra value of tobgp
which is
"All amounts"
. Then it has another variable called
tobacco_code
.
data_set_to_join <- data.frame(
tobgp = c("0-9g/day", "10-19", "20-29", "30+", "All amounts"),
tobacco_code = c("A", "B", "C", "D", "X")
)
tobgp | tobacco_code |
---|---|
0-9g/day | A |
10-19 | B |
20-29 | C |
30+ | D |
All amounts | X |
The join functions from tidyverse are inner_join
,
left_join
, right_join
and
full_join
. You can probably guess what each of these does
(if you’re not sure check the help, e.g. ?left_join
). Let’s
do a left join of the cancer dataset onto data_set_to_join. The first
two arguments to the join function are the two datasets to be joined,
and then there is a by
argument which is the joining
variable wrapped in quotes. If there is more than one joining variable
then they are passed to by
as a vector
(e.g. by = c("var_1", "var_2")
). You can actually leave out
the by
argument and R will join by whatever common
variables are present.
We’ll output the resulting dataframe into a new object called
‘combined_dataset’. The value of "All amounts"
for
tobgp
does not appear in combined_dataset since this is a
left join, but it would appear if you did a full_join
or a
right_join
instead.
combined_dataset <- left_join(cancer, data_set_to_join , by = "tobgp")
agegp | alcgp | tobgp | ncases | ncontrols | tobacco_code |
---|---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 | A |
25-34 | 0-39g/day | 10-19 | 0 | 10 | B |
25-34 | 0-39g/day | 20-29 | 0 | 6 | C |
25-34 | 0-39g/day | 30+ | 0 | 5 | D |
25-34 | 40-79 | 0-9g/day | 0 | 27 | A |
25-34 | 40-79 | 10-19 | 0 | 7 | B |
25-34 | 40-79 | 20-29 | 0 | 4 | C |
25-34 | 40-79 | 30+ | 0 | 7 | D |
25-34 | 80-119 | 0-9g/day | 0 | 2 | A |
25-34 | 80-119 | 10-19 | 0 | 1 | B |
25-34 | 80-119 | 30+ | 0 | 2 | D |
25-34 | 120+ | 0-9g/day | 0 | 1 | A |
25-34 | 120+ | 10-19 | 1 | 0 | B |
25-34 | 120+ | 20-29 | 0 | 1 | C |
25-34 | 120+ | 30+ | 0 | 2 | D |
35-44 | 0-39g/day | 0-9g/day | 0 | 60 | A |
35-44 | 0-39g/day | 10-19 | 1 | 13 | B |
35-44 | 0-39g/day | 20-29 | 0 | 7 | C |
35-44 | 0-39g/day | 30+ | 0 | 8 | D |
35-44 | 40-79 | 0-9g/day | 0 | 35 | A |
35-44 | 40-79 | 10-19 | 3 | 20 | B |
35-44 | 40-79 | 20-29 | 1 | 13 | C |
35-44 | 40-79 | 30+ | 0 | 8 | D |
35-44 | 80-119 | 0-9g/day | 0 | 11 | A |
35-44 | 80-119 | 10-19 | 0 | 6 | B |
35-44 | 80-119 | 20-29 | 0 | 2 | C |
35-44 | 80-119 | 30+ | 0 | 1 | D |
35-44 | 120+ | 0-9g/day | 2 | 1 | A |
35-44 | 120+ | 10-19 | 0 | 3 | B |
35-44 | 120+ | 20-29 | 2 | 2 | C |
45-54 | 0-39g/day | 0-9g/day | 1 | 45 | A |
45-54 | 0-39g/day | 10-19 | 0 | 18 | B |
45-54 | 0-39g/day | 20-29 | 0 | 10 | C |
45-54 | 0-39g/day | 30+ | 0 | 4 | D |
45-54 | 40-79 | 0-9g/day | 6 | 32 | A |
45-54 | 40-79 | 10-19 | 4 | 17 | B |
45-54 | 40-79 | 20-29 | 5 | 10 | C |
45-54 | 40-79 | 30+ | 5 | 2 | D |
45-54 | 80-119 | 0-9g/day | 3 | 13 | A |
45-54 | 80-119 | 10-19 | 6 | 8 | B |
45-54 | 80-119 | 20-29 | 1 | 4 | C |
45-54 | 80-119 | 30+ | 2 | 2 | D |
45-54 | 120+ | 0-9g/day | 4 | 0 | A |
45-54 | 120+ | 10-19 | 3 | 1 | B |
45-54 | 120+ | 20-29 | 2 | 1 | C |
45-54 | 120+ | 30+ | 4 | 0 | D |
55-64 | 0-39g/day | 0-9g/day | 2 | 47 | A |
55-64 | 0-39g/day | 10-19 | 3 | 19 | B |
55-64 | 0-39g/day | 20-29 | 3 | 9 | C |
55-64 | 0-39g/day | 30+ | 4 | 2 | D |
55-64 | 40-79 | 0-9g/day | 9 | 31 | A |
55-64 | 40-79 | 10-19 | 6 | 15 | B |
55-64 | 40-79 | 20-29 | 4 | 13 | C |
55-64 | 40-79 | 30+ | 3 | 3 | D |
55-64 | 80-119 | 0-9g/day | 9 | 9 | A |
55-64 | 80-119 | 10-19 | 8 | 7 | B |
55-64 | 80-119 | 20-29 | 3 | 3 | C |
55-64 | 80-119 | 30+ | 4 | 0 | D |
55-64 | 120+ | 0-9g/day | 5 | 5 | A |
55-64 | 120+ | 10-19 | 6 | 1 | B |
55-64 | 120+ | 20-29 | 2 | 1 | C |
55-64 | 120+ | 30+ | 5 | 1 | D |
65-74 | 0-39g/day | 0-9g/day | 5 | 43 | A |
65-74 | 0-39g/day | 10-19 | 4 | 10 | B |
65-74 | 0-39g/day | 20-29 | 2 | 5 | C |
65-74 | 0-39g/day | 30+ | 0 | 2 | D |
65-74 | 40-79 | 0-9g/day | 17 | 17 | A |
65-74 | 40-79 | 10-19 | 3 | 7 | B |
65-74 | 40-79 | 20-29 | 5 | 4 | C |
65-74 | 80-119 | 0-9g/day | 6 | 7 | A |
65-74 | 80-119 | 10-19 | 4 | 8 | B |
65-74 | 80-119 | 20-29 | 2 | 1 | C |
65-74 | 80-119 | 30+ | 1 | 0 | D |
65-74 | 120+ | 0-9g/day | 3 | 1 | A |
65-74 | 120+ | 10-19 | 1 | 1 | B |
65-74 | 120+ | 20-29 | 1 | 0 | C |
65-74 | 120+ | 30+ | 1 | 0 | D |
75+ | 0-39g/day | 0-9g/day | 1 | 17 | A |
75+ | 0-39g/day | 10-19 | 2 | 4 | B |
75+ | 0-39g/day | 30+ | 1 | 2 | D |
75+ | 40-79 | 0-9g/day | 2 | 3 | A |
75+ | 40-79 | 10-19 | 1 | 2 | B |
75+ | 40-79 | 20-29 | 0 | 3 | C |
75+ | 40-79 | 30+ | 1 | 0 | D |
75+ | 80-119 | 0-9g/day | 1 | 0 | A |
75+ | 80-119 | 10-19 | 1 | 0 | B |
75+ | 120+ | 0-9g/day | 2 | 0 | A |
75+ | 120+ | 10-19 | 1 | 0 | B |
We can also combine datasets by binding them vertically using
bind_rows
and horizontally using bind_cols
.
These functions take the datasets to be bound together as arguments. We
don’t have any datasets to bind ready to hand, so let’s produce
‘cancer_young’ containing the rows from ‘cancer’ where the age is
“25-34
” and ‘cancer_old’ where the age is
"75+"
.
cancer_young <- cancer %>%
filter(agegp == "25-34")
cancer_old <- cancer %>%
filter(agegp == "75+")
Now we can bind these together vertically using
bind_rows
(sorry that this example is a bit
artificial).
combined_dataset <- bind_rows(cancer_young, cancer_old)
agegp | alcgp | tobgp | ncases | ncontrols |
---|---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 0 | 40 |
25-34 | 0-39g/day | 10-19 | 0 | 10 |
25-34 | 0-39g/day | 20-29 | 0 | 6 |
25-34 | 0-39g/day | 30+ | 0 | 5 |
25-34 | 40-79 | 0-9g/day | 0 | 27 |
25-34 | 40-79 | 10-19 | 0 | 7 |
25-34 | 40-79 | 20-29 | 0 | 4 |
25-34 | 40-79 | 30+ | 0 | 7 |
25-34 | 80-119 | 0-9g/day | 0 | 2 |
25-34 | 80-119 | 10-19 | 0 | 1 |
25-34 | 80-119 | 30+ | 0 | 2 |
25-34 | 120+ | 0-9g/day | 0 | 1 |
25-34 | 120+ | 10-19 | 1 | 0 |
25-34 | 120+ | 20-29 | 0 | 1 |
25-34 | 120+ | 30+ | 0 | 2 |
75+ | 0-39g/day | 0-9g/day | 1 | 17 |
75+ | 0-39g/day | 10-19 | 2 | 4 |
75+ | 0-39g/day | 30+ | 1 | 2 |
75+ | 40-79 | 0-9g/day | 2 | 3 |
75+ | 40-79 | 10-19 | 1 | 2 |
75+ | 40-79 | 20-29 | 0 | 3 |
75+ | 40-79 | 30+ | 1 | 0 |
75+ | 80-119 | 0-9g/day | 1 | 0 |
75+ | 80-119 | 10-19 | 1 | 0 |
75+ | 120+ | 0-9g/day | 2 | 0 |
75+ | 120+ | 10-19 | 1 | 0 |
If there was a variable in one dataset but not in the other, then it
would appear in the resulting dataset with values of NA
for
the rows coming from the dataset where it did not exist.
The function bind_cols
works in a similar fashion. One
or more of arguments can be a vector. It produces an error if the
dataframes/vectors have varying numbers of rows/elements.
As well as data stored in R’s own file format (.rds) and fairly
common data file types like .csv and .txt, you can import a very wide
range of data files from other programs through different packages. The
package readxl provides functions for reading in Excel files, and the
package haven has functions read_sas
for SAS files,
read_stata
for Stata files, and read_sav
for
SPSS files. There are ‘write’ versions of these functions that allow you
to output these types of files from R. Both readxl and haven are
installed as part of the tidyverse collection but they are not loaded
with library(tidyverse)
, so you would have to load them
seperately to use these functions
(e.g. library(readxl)
).
Here we’ll just look at CSVs and the native data file format for R (.rds).
We can read in a CSV using read_csv
. The only argument
it really needs is the filename, so you could use it like:
my_dataframe <- read_csv("my_folder/my_csv_file.csv")
By default it assumes that there is a header row in your CSV which
becomes the column names for the dataframe. If that is not the case then
use the additional argument col_names = FALSE
, and it will
come up with some default column names on its own.
To write a dataframe to CSV you use write_csv
, which
takes a dataframe as the first argument and the filename as the second
argument, so you could use it like:
write_csv(my_dataframe, "my_folder/my_csv_file.csv")
One thing with read_csv
and read_excel
:
When these functions are used to read a file, they guess the type of a
column by looking at the first number of rows. The number of rows that
it examines before reading the file is determined by the argument
guess_max
, which by default is set to 1,000. I had a case
where I had a very large Excel file and there were some columns with
more than 1,000 missing cells before it got to an actual non-missing
value. The function read_excel
then mistook the type of the
column and it wasn’t read correctly. So I had to set
guess_max = Inf
(Inf
meaning infinity) so that
it checked all the rows to correctly determine column type.
To save a single dataframe to file, use saveRDS
. It
works the same way as write_csv
, e.g.
saveRDS(my_dataframe, "my_folder/my_rds_file.rds")
And to read such a file use readRDS
, like so:
a_new_dataframe <- readRDS("my_folder/my_rds_file.rds")
save
and load
. I don’t
use them so much. The key differences are that you can save and load as
many objects as you like with single save
and
load
functions, and the load
function brings
back all of the objects with the same names that they were saved with,
you don’t use load
with the assignment operator to make a
new object.
Pivoting dataframes can be tricky but I need to do it a lot with data imported from the CSO’s open data portal so I’ll give a guide here.
To keep things simple we will only consider pivots involving one column for names and one for values when pivoting wider, and one resultant column for names and one resultant column for values when pivoting longer.
Let’s take our cancer dataset again, forget about ncases
(we’ll drop that) and pivot the table so that we have four new columns
for each of the tobgp
values, and the values within those
columns will be ncontrols
for the appropriate combination
of tobgp
, agegp
and alcgp
. For
this we use pivot_wider
. The two important arguments to
this are names_from
which is equal to the name of the
variable that will provide names for our new columns, and
values_from
which is the values that will sit in those new
columns. We’ll pop the output into a new dataframe called
wide_cancer_dataset
agegp | alcgp | 0-9g/day | 10-19 | 20-29 | 30+ |
---|---|---|---|---|---|
25-34 | 0-39g/day | 40 | 10 | 6 | 5 |
25-34 | 40-79 | 27 | 7 | 4 | 7 |
25-34 | 80-119 | 2 | 1 | NA | 2 |
25-34 | 120+ | 1 | 0 | 1 | 2 |
35-44 | 0-39g/day | 60 | 13 | 7 | 8 |
35-44 | 40-79 | 35 | 20 | 13 | 8 |
35-44 | 80-119 | 11 | 6 | 2 | 1 |
35-44 | 120+ | 1 | 3 | 2 | NA |
45-54 | 0-39g/day | 45 | 18 | 10 | 4 |
45-54 | 40-79 | 32 | 17 | 10 | 2 |
45-54 | 80-119 | 13 | 8 | 4 | 2 |
45-54 | 120+ | 0 | 1 | 1 | 0 |
55-64 | 0-39g/day | 47 | 19 | 9 | 2 |
55-64 | 40-79 | 31 | 15 | 13 | 3 |
55-64 | 80-119 | 9 | 7 | 3 | 0 |
55-64 | 120+ | 5 | 1 | 1 | 1 |
65-74 | 0-39g/day | 43 | 10 | 5 | 2 |
65-74 | 40-79 | 17 | 7 | 4 | NA |
65-74 | 80-119 | 7 | 8 | 1 | 0 |
65-74 | 120+ | 1 | 1 | 0 | 0 |
75+ | 0-39g/day | 17 | 4 | NA | 2 |
75+ | 40-79 | 3 | 2 | 3 | 0 |
75+ | 80-119 | 0 | 0 | NA | NA |
75+ | 120+ | 0 | 0 | NA | NA |
wide_cancer_dataset <- cancer %>%
select(-ncases) %>%
pivot_wider(names_from = tobgp, values_from = ncontrols)
You might notice some NA
values among the new dataset.
This is because wide_cancer_dataset
include some
combinations that weren’t in the original cancer dataset,
e.g. agegp = "25-34"
, alcgp = "80-119"
and
tobgp = "20-29"
didn’t appear in the cancer dataset. If you
wanted to set those NA
values to zero at the time of
pivoting, you could use the extra argument
values_fill = 0
.
You can also add a prefix to your new columns using the additional
argument names_prefix
, which takes a string,
e.g. names_prefix = "tobgp_"
.
Let’s take wide_cancer_dataset
and convert it back into
a longer format. We’ll use the function pivot_longer
. It
has three key arguments: - cols
: this specifies the columns
to be pivoted into rows - names_to
: the name for the new
column which contains the names of the columns that you are pivoting -
values_to
: the name for the new column which contains the
values from the columns that you are pivoting.
wide_cancer_dataset %>%
pivot_longer(cols = c("0-9g/day", "10-19", "20-29","30+"),
names_to = "tobgp",
values_to = "ncontrols")
agegp | alcgp | tobgp | ncontrols |
---|---|---|---|
25-34 | 0-39g/day | 0-9g/day | 40 |
25-34 | 0-39g/day | 10-19 | 10 |
25-34 | 0-39g/day | 20-29 | 6 |
25-34 | 0-39g/day | 30+ | 5 |
25-34 | 40-79 | 0-9g/day | 27 |
25-34 | 40-79 | 10-19 | 7 |
25-34 | 40-79 | 20-29 | 4 |
25-34 | 40-79 | 30+ | 7 |
25-34 | 80-119 | 0-9g/day | 2 |
25-34 | 80-119 | 10-19 | 1 |
25-34 | 80-119 | 20-29 | NA |
25-34 | 80-119 | 30+ | 2 |
25-34 | 120+ | 0-9g/day | 1 |
25-34 | 120+ | 10-19 | 0 |
25-34 | 120+ | 20-29 | 1 |
25-34 | 120+ | 30+ | 2 |
35-44 | 0-39g/day | 0-9g/day | 60 |
35-44 | 0-39g/day | 10-19 | 13 |
35-44 | 0-39g/day | 20-29 | 7 |
35-44 | 0-39g/day | 30+ | 8 |
35-44 | 40-79 | 0-9g/day | 35 |
35-44 | 40-79 | 10-19 | 20 |
35-44 | 40-79 | 20-29 | 13 |
35-44 | 40-79 | 30+ | 8 |
35-44 | 80-119 | 0-9g/day | 11 |
35-44 | 80-119 | 10-19 | 6 |
35-44 | 80-119 | 20-29 | 2 |
35-44 | 80-119 | 30+ | 1 |
35-44 | 120+ | 0-9g/day | 1 |
35-44 | 120+ | 10-19 | 3 |
35-44 | 120+ | 20-29 | 2 |
35-44 | 120+ | 30+ | NA |
45-54 | 0-39g/day | 0-9g/day | 45 |
45-54 | 0-39g/day | 10-19 | 18 |
45-54 | 0-39g/day | 20-29 | 10 |
45-54 | 0-39g/day | 30+ | 4 |
45-54 | 40-79 | 0-9g/day | 32 |
45-54 | 40-79 | 10-19 | 17 |
45-54 | 40-79 | 20-29 | 10 |
45-54 | 40-79 | 30+ | 2 |
45-54 | 80-119 | 0-9g/day | 13 |
45-54 | 80-119 | 10-19 | 8 |
45-54 | 80-119 | 20-29 | 4 |
45-54 | 80-119 | 30+ | 2 |
45-54 | 120+ | 0-9g/day | 0 |
45-54 | 120+ | 10-19 | 1 |
45-54 | 120+ | 20-29 | 1 |
45-54 | 120+ | 30+ | 0 |
55-64 | 0-39g/day | 0-9g/day | 47 |
55-64 | 0-39g/day | 10-19 | 19 |
55-64 | 0-39g/day | 20-29 | 9 |
55-64 | 0-39g/day | 30+ | 2 |
55-64 | 40-79 | 0-9g/day | 31 |
55-64 | 40-79 | 10-19 | 15 |
55-64 | 40-79 | 20-29 | 13 |
55-64 | 40-79 | 30+ | 3 |
55-64 | 80-119 | 0-9g/day | 9 |
55-64 | 80-119 | 10-19 | 7 |
55-64 | 80-119 | 20-29 | 3 |
55-64 | 80-119 | 30+ | 0 |
55-64 | 120+ | 0-9g/day | 5 |
55-64 | 120+ | 10-19 | 1 |
55-64 | 120+ | 20-29 | 1 |
55-64 | 120+ | 30+ | 1 |
65-74 | 0-39g/day | 0-9g/day | 43 |
65-74 | 0-39g/day | 10-19 | 10 |
65-74 | 0-39g/day | 20-29 | 5 |
65-74 | 0-39g/day | 30+ | 2 |
65-74 | 40-79 | 0-9g/day | 17 |
65-74 | 40-79 | 10-19 | 7 |
65-74 | 40-79 | 20-29 | 4 |
65-74 | 40-79 | 30+ | NA |
65-74 | 80-119 | 0-9g/day | 7 |
65-74 | 80-119 | 10-19 | 8 |
65-74 | 80-119 | 20-29 | 1 |
65-74 | 80-119 | 30+ | 0 |
65-74 | 120+ | 0-9g/day | 1 |
65-74 | 120+ | 10-19 | 1 |
65-74 | 120+ | 20-29 | 0 |
65-74 | 120+ | 30+ | 0 |
75+ | 0-39g/day | 0-9g/day | 17 |
75+ | 0-39g/day | 10-19 | 4 |
75+ | 0-39g/day | 20-29 | NA |
75+ | 0-39g/day | 30+ | 2 |
75+ | 40-79 | 0-9g/day | 3 |
75+ | 40-79 | 10-19 | 2 |
75+ | 40-79 | 20-29 | 3 |
75+ | 40-79 | 30+ | 0 |
75+ | 80-119 | 0-9g/day | 0 |
75+ | 80-119 | 10-19 | 0 |
75+ | 80-119 | 20-29 | NA |
75+ | 80-119 | 30+ | NA |
75+ | 120+ | 0-9g/day | 0 |
75+ | 120+ | 10-19 | 0 |
75+ | 120+ | 20-29 | NA |
75+ | 120+ | 30+ | NA |
That’s all fine, but specifying the four column names is a bit
fiddly. Instead we can specify the columns which will
not be pivoted, which are agegp
and
alcgp
. To do that we pop in these column names with the
argument cols =
but put a minus in front
of the vector containing these names. The output isn’t shown here but
the result is the same as the above.
wide_cancer_dataset %>%
pivot_longer(cols = -c("alcgp", "agegp"),
names_to = "tobgp",
values_to = "ncontrols")
You should know that the selection helper functions (like
contains
, starts_with
and
ends_with
) can be used when specifying the list of columns
which are to be pivoted. Suppose in making
wide_cancer_dataset
that we had used
names_prefix = "tobgp_"
so that each of our tobacco columns
started with the string "tobgp_"
. Then we could have
pivoted longer by specifying our column selection as
cols = starts_with("tobgp_")
.
We could also have used the where
selection helper
together with is.numeric
to pivot only the numerical type
columns. The code for this is shown below but the results are not since
they are the same as before.
wide_cancer_dataset %>%
pivot_longer(cols = where(is.numeric),
names_to = "tobgp",
values_to = "ncontrols")
One last thing is that the NA
values from
wide_cancer_dataset
have appeared in the output. If you
didn’t want that to be the case you could use the additional argument
values_drop_na
, setting it equal to TRUE
.
Plotting is done through the ggplot2 package, which is a core
tidyverse package and is loaded with
library(tidyverse)
.
There are other handy functions for plotting like plot
and qplot
, but I think it’s best to start with ggplot2
because the format is so general.
The way it works is something like the pseudocode shown below. It
starts out with the function ggplot
which just takes the
dataframe as its argument. Then there is a geometry type function which
specifies the kind of plot that will be made. There is
geom_point
for points (scatterplot), geom_line
for lines, geom_col
which I use for both column and bar
charts, and lots more asides. I’ve just used geom_XXX
as a
placeholder here, there is no function called geom_XXX
.
Within the geometry function is the aesthetic mapping function
aes
. This is where you specify what variables in the data
are associated with x
and y
as well as other
variables you might have like size
, shape
,
colour
, fill
etc.
You can have more than one geometry function,
e.g. geom_line
and geom_points
for a plot with
both points and lines. You only ever have one ggplot
function per plot though.
The other_functions
alluded to below refers to functions
for altering the appearance of the plot. Don’t worry about that for
now.
You’ll notice all the separate parts are connected to by a plus sign.
I like to insert a new line after each +
for ease of
reading. The indentation is automatic.
ggplot(data = the_dataframe) +
geom_XXX(mapping = aes(x = var_1 , y = var_2 , <other_variables>) , <options_for_this_geom> ) +
other_functions ...
Just so you know, the dataset can be defined within the geometry
function (you can put data =
within geom_XXX
)
and the aesthetic mapping function can be defined within
ggplot
(you can put mapping = aes(...)
within
ggplot
).
Here we’ll use the population dataset that comes loaded with
tidyverse, but doesn’t appear in the Environment panel. You can view it
by running View(population)
. We’ll make plots using subsets
of data from this, making a dataset called dataset_to_plot
each time.
country | year | population |
---|---|---|
Afghanistan | 1995 | 17586073 |
Afghanistan | 1996 | 18415307 |
Afghanistan | 1997 | 19021226 |
Afghanistan | 1998 | 19496836 |
Afghanistan | 1999 | 19987071 |
Afghanistan | 2000 | 20595360 |
Afghanistan | 2001 | 21347782 |
Afghanistan | 2002 | 22202806 |
Afghanistan | 2003 | 23116142 |
Afghanistan | 2004 | 24018682 |
Afghanistan | 2005 | 24860855 |
Afghanistan | 2006 | 25631282 |
Afghanistan | 2007 | 26349243 |
Afghanistan | 2008 | 27032197 |
Afghanistan | 2009 | 27708187 |
Afghanistan | 2010 | 28397812 |
Afghanistan | 2011 | 29105480 |
Afghanistan | 2012 | 29824536 |
Afghanistan | 2013 | 30551674 |
Albania | 1995 | 3357858 |
Albania | 1996 | 3341043 |
Albania | 1997 | 3331317 |
Albania | 1998 | 3325456 |
Albania | 1999 | 3317941 |
Albania | 2000 | 3304948 |
Albania | 2001 | 3286084 |
Albania | 2002 | 3263596 |
Albania | 2003 | 3239385 |
Albania | 2004 | 3216197 |
Albania | 2005 | 3196130 |
Albania | 2006 | 3179573 |
Albania | 2007 | 3166222 |
Albania | 2008 | 3156608 |
Albania | 2009 | 3151185 |
Albania | 2010 | 3150143 |
Albania | 2011 | 3153883 |
Albania | 2012 | 3162083 |
Albania | 2013 | 3173271 |
Algeria | 1995 | 29315463 |
Algeria | 1996 | 29845208 |
Algeria | 1997 | 30345466 |
Algeria | 1998 | 30820435 |
Algeria | 1999 | 31276295 |
Algeria | 2000 | 31719449 |
Algeria | 2001 | 32150198 |
Algeria | 2002 | 32572977 |
Algeria | 2003 | 33003442 |
Algeria | 2004 | 33461345 |
Algeria | 2005 | 33960903 |
Algeria | 2006 | 34507214 |
Algeria | 2007 | 35097043 |
Algeria | 2008 | 35725377 |
Algeria | 2009 | 36383302 |
Algeria | 2010 | 37062820 |
Algeria | 2011 | 37762962 |
Algeria | 2012 | 38481705 |
Algeria | 2013 | 39208194 |
American Samoa | 1995 | 52874 |
American Samoa | 1996 | 53926 |
American Samoa | 1997 | 54942 |
American Samoa | 1998 | 55899 |
American Samoa | 1999 | 56768 |
American Samoa | 2000 | 57522 |
American Samoa | 2001 | 58176 |
American Samoa | 2002 | 58729 |
American Samoa | 2003 | 59117 |
American Samoa | 2004 | 59262 |
American Samoa | 2005 | 59117 |
American Samoa | 2006 | 58652 |
American Samoa | 2007 | 57919 |
American Samoa | 2008 | 57053 |
American Samoa | 2009 | 56245 |
American Samoa | 2010 | 55636 |
American Samoa | 2011 | 55274 |
American Samoa | 2012 | 55128 |
American Samoa | 2013 | 55165 |
Andorra | 1995 | 63854 |
Andorra | 1996 | 64274 |
Andorra | 1997 | 64090 |
Andorra | 1998 | 63799 |
Andorra | 1999 | 64084 |
Andorra | 2000 | 65399 |
Andorra | 2001 | 68000 |
Andorra | 2002 | 71639 |
Andorra | 2003 | 75643 |
Andorra | 2004 | 79060 |
Andorra | 2005 | 81223 |
Andorra | 2006 | 81877 |
Andorra | 2007 | 81292 |
Andorra | 2008 | 79969 |
Andorra | 2009 | 78659 |
Andorra | 2010 | 77907 |
Andorra | 2011 | 77865 |
Andorra | 2012 | 78360 |
Andorra | 2013 | 79218 |
Angola | 1995 | 12104952 |
Angola | 1996 | 12451945 |
Angola | 1997 | 12791388 |
Angola | 1998 | 13137542 |
Angola | 1999 | 13510616 |
Angola | 2000 | 13924930 |
Angola | 2001 | 14385283 |
Angola | 2002 | 14886574 |
Angola | 2003 | 15421075 |
Angola | 2004 | 15976715 |
Angola | 2005 | 16544376 |
Angola | 2006 | 17122409 |
Angola | 2007 | 17712824 |
Angola | 2008 | 18314441 |
Angola | 2009 | 18926650 |
Angola | 2010 | 19549124 |
Angola | 2011 | 20180490 |
Angola | 2012 | 20820525 |
Angola | 2013 | 21471618 |
Anguilla | 1995 | 9807 |
Anguilla | 1996 | 10063 |
Anguilla | 1997 | 10305 |
Anguilla | 1998 | 10545 |
Anguilla | 1999 | 10797 |
Anguilla | 2000 | 11071 |
Anguilla | 2001 | 11371 |
Anguilla | 2002 | 11693 |
Anguilla | 2003 | 12023 |
Anguilla | 2004 | 12342 |
Anguilla | 2005 | 12637 |
Anguilla | 2006 | 12903 |
Anguilla | 2007 | 13145 |
Anguilla | 2008 | 13365 |
Anguilla | 2009 | 13571 |
Anguilla | 2010 | 13768 |
Anguilla | 2011 | 13956 |
Anguilla | 2012 | 14132 |
Anguilla | 2013 | 14300 |
Antigua and Barbuda | 1995 | 68349 |
Antigua and Barbuda | 1996 | 70245 |
Antigua and Barbuda | 1997 | 72232 |
Antigua and Barbuda | 1998 | 74206 |
Antigua and Barbuda | 1999 | 76041 |
Antigua and Barbuda | 2000 | 77648 |
Antigua and Barbuda | 2001 | 78972 |
Antigua and Barbuda | 2002 | 80030 |
Antigua and Barbuda | 2003 | 80904 |
Antigua and Barbuda | 2004 | 81718 |
Antigua and Barbuda | 2005 | 82565 |
Antigua and Barbuda | 2006 | 83467 |
Antigua and Barbuda | 2007 | 84397 |
Antigua and Barbuda | 2008 | 85349 |
Antigua and Barbuda | 2009 | 86300 |
Antigua and Barbuda | 2010 | 87233 |
Antigua and Barbuda | 2011 | 88152 |
Antigua and Barbuda | 2012 | 89069 |
Antigua and Barbuda | 2013 | 89985 |
Argentina | 1995 | 34833168 |
Argentina | 1996 | 35264070 |
Argentina | 1997 | 35690778 |
Argentina | 1998 | 36109342 |
Argentina | 1999 | 36514558 |
Argentina | 2000 | 36903067 |
Argentina | 2001 | 37273361 |
Argentina | 2002 | 37627545 |
Argentina | 2003 | 37970411 |
Argentina | 2004 | 38308779 |
Argentina | 2005 | 38647854 |
Argentina | 2006 | 38988923 |
Argentina | 2007 | 39331357 |
Argentina | 2008 | 39676083 |
Argentina | 2009 | 40023641 |
Argentina | 2010 | 40374224 |
Argentina | 2011 | 40728738 |
Argentina | 2012 | 41086927 |
Argentina | 2013 | 41446246 |
Armenia | 1995 | 3223173 |
Armenia | 1996 | 3173425 |
Armenia | 1997 | 3137652 |
Armenia | 1998 | 3112958 |
Armenia | 1999 | 3093820 |
Armenia | 2000 | 3076098 |
Armenia | 2001 | 3059960 |
Armenia | 2002 | 3047002 |
Armenia | 2003 | 3036032 |
Armenia | 2004 | 3025652 |
Armenia | 2005 | 3014917 |
Armenia | 2006 | 3002911 |
Armenia | 2007 | 2989882 |
Armenia | 2008 | 2977488 |
Armenia | 2009 | 2968154 |
Armenia | 2010 | 2963496 |
Armenia | 2011 | 2964120 |
Armenia | 2012 | 2969081 |
Armenia | 2013 | 2976566 |
Aruba | 1995 | 80326 |
Aruba | 1996 | 83195 |
Aruba | 1997 | 85447 |
Aruba | 1998 | 87276 |
Aruba | 1999 | 89004 |
Aruba | 2000 | 90858 |
Aruba | 2001 | 92894 |
Aruba | 2002 | 94995 |
Aruba | 2003 | 97015 |
Aruba | 2004 | 98742 |
Aruba | 2005 | 100031 |
Aruba | 2006 | 100830 |
Aruba | 2007 | 101219 |
Aruba | 2008 | 101344 |
Aruba | 2009 | 101418 |
Aruba | 2010 | 101597 |
Aruba | 2011 | 101932 |
Aruba | 2012 | 102384 |
Aruba | 2013 | 102911 |
Australia | 1995 | 18124234 |
Australia | 1996 | 18339037 |
Australia | 1997 | 18563442 |
Australia | 1998 | 18794552 |
Australia | 1999 | 19027438 |
Australia | 2000 | 19259377 |
Australia | 2001 | 19487257 |
Australia | 2002 | 19714625 |
Australia | 2003 | 19953121 |
Australia | 2004 | 20218481 |
Australia | 2005 | 20520736 |
Australia | 2006 | 20865583 |
Australia | 2007 | 21246274 |
Australia | 2008 | 21645095 |
Australia | 2009 | 22037143 |
Australia | 2010 | 22404488 |
Australia | 2011 | 22740536 |
Australia | 2012 | 23050471 |
Australia | 2013 | 23342553 |
Austria | 1995 | 7985372 |
Austria | 1996 | 8009345 |
Austria | 1997 | 8014124 |
Austria | 1998 | 8009051 |
Austria | 1999 | 8007843 |
Austria | 2000 | 8020262 |
Austria | 2001 | 8049440 |
Austria | 2002 | 8091804 |
Austria | 2003 | 8142322 |
Austria | 2004 | 8193157 |
Austria | 2005 | 8238604 |
Austria | 2006 | 8277393 |
Austria | 2007 | 8311463 |
Austria | 2008 | 8342129 |
Austria | 2009 | 8371711 |
Austria | 2010 | 8401924 |
Austria | 2011 | 8432890 |
Austria | 2012 | 8463948 |
Austria | 2013 | 8495145 |
Azerbaijan | 1995 | 7770806 |
Azerbaijan | 1996 | 7852273 |
Azerbaijan | 1997 | 7921745 |
Azerbaijan | 1998 | 7984460 |
Azerbaijan | 1999 | 8047936 |
Azerbaijan | 2000 | 8117742 |
Azerbaijan | 2001 | 8195427 |
Azerbaijan | 2002 | 8279768 |
Azerbaijan | 2003 | 8370169 |
Azerbaijan | 2004 | 8465127 |
Azerbaijan | 2005 | 8563398 |
Azerbaijan | 2006 | 8665006 |
Azerbaijan | 2007 | 8770122 |
Azerbaijan | 2008 | 8877669 |
Azerbaijan | 2009 | 8986266 |
Azerbaijan | 2010 | 9094718 |
Azerbaijan | 2011 | 9202432 |
Azerbaijan | 2012 | 9308959 |
Azerbaijan | 2013 | 9413420 |
Bahamas | 1995 | 280050 |
Bahamas | 1996 | 283678 |
Bahamas | 1997 | 286845 |
Bahamas | 1998 | 289926 |
Bahamas | 1999 | 293442 |
Bahamas | 2000 | 297759 |
Bahamas | 2001 | 303005 |
Bahamas | 2002 | 309039 |
Bahamas | 2003 | 315624 |
Bahamas | 2004 | 322400 |
Bahamas | 2005 | 329088 |
Bahamas | 2006 | 335622 |
Bahamas | 2007 | 342049 |
Bahamas | 2008 | 348340 |
Bahamas | 2009 | 354492 |
Bahamas | 2010 | 360498 |
Bahamas | 2011 | 366331 |
Bahamas | 2012 | 371960 |
Bahamas | 2013 | 377374 |
Bahrain | 1995 | 563730 |
Bahrain | 1996 | 579697 |
Bahrain | 1997 | 597400 |
Bahrain | 1998 | 617537 |
Bahrain | 1999 | 640913 |
Bahrain | 2000 | 668239 |
Bahrain | 2001 | 698749 |
Bahrain | 2002 | 732541 |
Bahrain | 2003 | 772058 |
Bahrain | 2004 | 820505 |
Bahrain | 2005 | 879534 |
Bahrain | 2006 | 950951 |
Bahrain | 2007 | 1032353 |
Bahrain | 2008 | 1116038 |
Bahrain | 2009 | 1191539 |
Bahrain | 2010 | 1251513 |
Bahrain | 2011 | 1292764 |
Bahrain | 2012 | 1317827 |
Bahrain | 2013 | 1332171 |
Bangladesh | 1995 | 119869585 |
Bangladesh | 1996 | 122400896 |
Bangladesh | 1997 | 124945315 |
Bangladesh | 1998 | 127478524 |
Bangladesh | 1999 | 129966823 |
Bangladesh | 2000 | 132383265 |
Bangladesh | 2001 | 134729503 |
Bangladesh | 2002 | 137006279 |
Bangladesh | 2003 | 139185986 |
Bangladesh | 2004 | 141235035 |
Bangladesh | 2005 | 143135180 |
Bangladesh | 2006 | 144868702 |
Bangladesh | 2007 | 146457067 |
Bangladesh | 2008 | 147969967 |
Bangladesh | 2009 | 149503100 |
Bangladesh | 2010 | 151125475 |
Bangladesh | 2011 | 152862431 |
Bangladesh | 2012 | 154695368 |
Bangladesh | 2013 | 156594962 |
Barbados | 1995 | 263165 |
Barbados | 1996 | 263884 |
Barbados | 1997 | 264606 |
Barbados | 1998 | 265370 |
Barbados | 1999 | 266220 |
Barbados | 2000 | 267190 |
Barbados | 2001 | 268296 |
Barbados | 2002 | 269524 |
Barbados | 2003 | 270844 |
Barbados | 2004 | 272205 |
Barbados | 2005 | 273568 |
Barbados | 2006 | 274923 |
Barbados | 2007 | 276277 |
Barbados | 2008 | 277634 |
Barbados | 2009 | 279006 |
Barbados | 2010 | 280396 |
Barbados | 2011 | 281804 |
Barbados | 2012 | 283221 |
Barbados | 2013 | 284644 |
Belarus | 1995 | 10189075 |
Belarus | 1996 | 10156258 |
Belarus | 1997 | 10120556 |
Belarus | 1998 | 10080772 |
Belarus | 1999 | 10034775 |
Belarus | 2000 | 9981460 |
Belarus | 2001 | 9920173 |
Belarus | 2002 | 9852866 |
Belarus | 2003 | 9784111 |
Belarus | 2004 | 9719991 |
Belarus | 2005 | 9664714 |
Belarus | 2006 | 9620359 |
Belarus | 2007 | 9585368 |
Belarus | 2008 | 9555801 |
Belarus | 2009 | 9525785 |
Belarus | 2010 | 9491070 |
Belarus | 2011 | 9450391 |
Belarus | 2012 | 9405097 |
Belarus | 2013 | 9356678 |
Belgium | 1995 | 10161914 |
Belgium | 1996 | 10186767 |
Belgium | 1997 | 10205970 |
Belgium | 1998 | 10222896 |
Belgium | 1999 | 10242449 |
Belgium | 2000 | 10268380 |
Belgium | 2001 | 10300775 |
Belgium | 2002 | 10338969 |
Belgium | 2003 | 10384953 |
Belgium | 2004 | 10440977 |
Belgium | 2005 | 10508080 |
Belgium | 2006 | 10587731 |
Belgium | 2007 | 10678058 |
Belgium | 2008 | 10772572 |
Belgium | 2009 | 10862441 |
Belgium | 2010 | 10941288 |
Belgium | 2011 | 11006632 |
Belgium | 2012 | 11060095 |
Belgium | 2013 | 11104476 |
Belize | 1995 | 206962 |
Belize | 1996 | 212375 |
Belize | 1997 | 218484 |
Belize | 1998 | 225083 |
Belize | 1999 | 231860 |
Belize | 2000 | 238586 |
Belize | 2001 | 245198 |
Belize | 2002 | 251766 |
Belize | 2003 | 258346 |
Belize | 2004 | 265040 |
Belize | 2005 | 271920 |
Belize | 2006 | 278985 |
Belize | 2007 | 286196 |
Belize | 2008 | 293544 |
Belize | 2009 | 301016 |
Belize | 2010 | 308595 |
Belize | 2011 | 316280 |
Belize | 2012 | 324060 |
Belize | 2013 | 331900 |
Benin | 1995 | 5985658 |
Benin | 1996 | 6176318 |
Benin | 1997 | 6361301 |
Benin | 1998 | 6546493 |
Benin | 1999 | 6740491 |
Benin | 2000 | 6949366 |
Benin | 2001 | 7174911 |
Benin | 2002 | 7414744 |
Benin | 2003 | 7665681 |
Benin | 2004 | 7922796 |
Benin | 2005 | 8182362 |
Benin | 2006 | 8443671 |
Benin | 2007 | 8707490 |
Benin | 2008 | 8973293 |
Benin | 2009 | 9240783 |
Benin | 2010 | 9509798 |
Benin | 2011 | 9779795 |
Benin | 2012 | 10050702 |
Benin | 2013 | 10323474 |
Bermuda | 1995 | 61407 |
Bermuda | 1996 | 61703 |
Bermuda | 1997 | 61992 |
Bermuda | 1998 | 62276 |
Bermuda | 1999 | 62557 |
Bermuda | 2000 | 62837 |
Bermuda | 2001 | 63116 |
Bermuda | 2002 | 63393 |
Bermuda | 2003 | 63661 |
Bermuda | 2004 | 63911 |
Bermuda | 2005 | 64137 |
Bermuda | 2006 | 64337 |
Bermuda | 2007 | 64512 |
Bermuda | 2008 | 64667 |
Bermuda | 2009 | 64812 |
Bermuda | 2010 | 64951 |
Bermuda | 2011 | 65086 |
Bermuda | 2012 | 65216 |
Bermuda | 2013 | 65341 |
Bhutan | 1995 | 509105 |
Bhutan | 1996 | 512594 |
Bhutan | 1997 | 521146 |
Bhutan | 1998 | 533737 |
Bhutan | 1999 | 548599 |
Bhutan | 2000 | 564350 |
Bhutan | 2001 | 580888 |
Bhutan | 2002 | 598455 |
Bhutan | 2003 | 616383 |
Bhutan | 2004 | 633893 |
Bhutan | 2005 | 650417 |
Bhutan | 2006 | 665568 |
Bhutan | 2007 | 679365 |
Bhutan | 2008 | 692159 |
Bhutan | 2009 | 704542 |
Bhutan | 2010 | 716939 |
Bhutan | 2011 | 729429 |
Bhutan | 2012 | 741822 |
Bhutan | 2013 | 753947 |
Bolivia (Plurinational State of) | 1995 | 7635362 |
Bolivia (Plurinational State of) | 1996 | 7806953 |
Bolivia (Plurinational State of) | 1997 | 7978521 |
Bolivia (Plurinational State of) | 1998 | 8150214 |
Bolivia (Plurinational State of) | 1999 | 8322408 |
Bolivia (Plurinational State of) | 2000 | 8495271 |
Bolivia (Plurinational State of) | 2001 | 8669066 |
Bolivia (Plurinational State of) | 2002 | 8843350 |
Bolivia (Plurinational State of) | 2003 | 9016787 |
Bolivia (Plurinational State of) | 2004 | 9187610 |
Bolivia (Plurinational State of) | 2005 | 9354709 |
Bolivia (Plurinational State of) | 2006 | 9517395 |
Bolivia (Plurinational State of) | 2007 | 9676456 |
Bolivia (Plurinational State of) | 2008 | 9834098 |
Bolivia (Plurinational State of) | 2009 | 9993406 |
Bolivia (Plurinational State of) | 2010 | 10156601 |
Bolivia (Plurinational State of) | 2011 | 10324445 |
Bolivia (Plurinational State of) | 2012 | 10496285 |
Bolivia (Plurinational State of) | 2013 | 10671200 |
Bonaire, Saint Eustatius and Saba | 2010 | 17616 |
Bonaire, Saint Eustatius and Saba | 2011 | 18194 |
Bonaire, Saint Eustatius and Saba | 2012 | 18694 |
Bonaire, Saint Eustatius and Saba | 2013 | 19130 |
Bosnia and Herzegovina | 1995 | 3520996 |
Bosnia and Herzegovina | 1996 | 3485575 |
Bosnia and Herzegovina | 1997 | 3535998 |
Bosnia and Herzegovina | 1998 | 3640821 |
Bosnia and Herzegovina | 1999 | 3752004 |
Bosnia and Herzegovina | 2000 | 3834364 |
Bosnia and Herzegovina | 2001 | 3879353 |
Bosnia and Herzegovina | 2002 | 3897579 |
Bosnia and Herzegovina | 2003 | 3895779 |
Bosnia and Herzegovina | 2004 | 3886723 |
Bosnia and Herzegovina | 2005 | 3879828 |
Bosnia and Herzegovina | 2006 | 3875157 |
Bosnia and Herzegovina | 2007 | 3868665 |
Bosnia and Herzegovina | 2008 | 3861201 |
Bosnia and Herzegovina | 2009 | 3853446 |
Bosnia and Herzegovina | 2010 | 3845929 |
Bosnia and Herzegovina | 2011 | 3839322 |
Bosnia and Herzegovina | 2012 | 3833916 |
Bosnia and Herzegovina | 2013 | 3829307 |
Botswana | 1995 | 1583453 |
Botswana | 1996 | 1620989 |
Botswana | 1997 | 1657349 |
Botswana | 1998 | 1692148 |
Botswana | 1999 | 1724924 |
Botswana | 2000 | 1755375 |
Botswana | 2001 | 1783349 |
Botswana | 2002 | 1808976 |
Botswana | 2003 | 1832602 |
Botswana | 2004 | 1854739 |
Botswana | 2005 | 1875805 |
Botswana | 2006 | 1895944 |
Botswana | 2007 | 1915187 |
Botswana | 2008 | 1933719 |
Botswana | 2009 | 1951715 |
Botswana | 2010 | 1969341 |
Botswana | 2011 | 1986701 |
Botswana | 2012 | 2003910 |
Botswana | 2013 | 2021144 |
Brazil | 1995 | 161890816 |
Brazil | 1996 | 164392423 |
Brazil | 1997 | 166925457 |
Brazil | 1998 | 169472347 |
Brazil | 1999 | 172006362 |
Brazil | 2000 | 174504898 |
Brazil | 2001 | 176968205 |
Brazil | 2002 | 179393768 |
Brazil | 2003 | 181752951 |
Brazil | 2004 | 184010283 |
Brazil | 2005 | 186142403 |
Brazil | 2006 | 188134315 |
Brazil | 2007 | 189996976 |
Brazil | 2008 | 191765567 |
Brazil | 2009 | 193490922 |
Brazil | 2010 | 195210154 |
Brazil | 2011 | 196935134 |
Brazil | 2012 | 198656019 |
Brazil | 2013 | 200361925 |
British Virgin Islands | 1995 | 18425 |
British Virgin Islands | 1996 | 18834 |
British Virgin Islands | 1997 | 19270 |
British Virgin Islands | 1998 | 19726 |
British Virgin Islands | 1999 | 20186 |
British Virgin Islands | 2000 | 20643 |
British Virgin Islands | 2001 | 21084 |
British Virgin Islands | 2002 | 21518 |
British Virgin Islands | 2003 | 21982 |
British Virgin Islands | 2004 | 22522 |
British Virgin Islands | 2005 | 23169 |
British Virgin Islands | 2006 | 23942 |
British Virgin Islands | 2007 | 24815 |
British Virgin Islands | 2008 | 25716 |
British Virgin Islands | 2009 | 26542 |
British Virgin Islands | 2010 | 27223 |
British Virgin Islands | 2011 | 27730 |
British Virgin Islands | 2012 | 28088 |
British Virgin Islands | 2013 | 28341 |
Brunei Darussalam | 1995 | 295003 |
Brunei Darussalam | 1996 | 302511 |
Brunei Darussalam | 1997 | 309904 |
Brunei Darussalam | 1998 | 317214 |
Brunei Darussalam | 1999 | 324501 |
Brunei Darussalam | 2000 | 331801 |
Brunei Darussalam | 2001 | 339114 |
Brunei Darussalam | 2002 | 346407 |
Brunei Darussalam | 2003 | 353649 |
Brunei Darussalam | 2004 | 360797 |
Brunei Darussalam | 2005 | 367815 |
Brunei Darussalam | 2006 | 374697 |
Brunei Darussalam | 2007 | 381440 |
Brunei Darussalam | 2008 | 388017 |
Brunei Darussalam | 2009 | 394400 |
Brunei Darussalam | 2010 | 400569 |
Brunei Darussalam | 2011 | 406512 |
Brunei Darussalam | 2012 | 412238 |
Brunei Darussalam | 2013 | 417784 |
Bulgaria | 1995 | 8358116 |
Bulgaria | 1996 | 8274592 |
Bulgaria | 1997 | 8199715 |
Bulgaria | 1998 | 8131424 |
Bulgaria | 1999 | 8065947 |
Bulgaria | 2000 | 8000510 |
Bulgaria | 2001 | 7934973 |
Bulgaria | 2002 | 7870488 |
Bulgaria | 2003 | 7806995 |
Bulgaria | 2004 | 7744575 |
Bulgaria | 2005 | 7683264 |
Bulgaria | 2006 | 7622852 |
Bulgaria | 2007 | 7563141 |
Bulgaria | 2008 | 7504206 |
Bulgaria | 2009 | 7446197 |
Bulgaria | 2010 | 7389175 |
Bulgaria | 2011 | 7333122 |
Bulgaria | 2012 | 7277831 |
Bulgaria | 2013 | 7222943 |
Burkina Faso | 1995 | 10089876 |
Burkina Faso | 1996 | 10372562 |
Burkina Faso | 1997 | 10664982 |
Burkina Faso | 1998 | 10967836 |
Burkina Faso | 1999 | 11281942 |
Burkina Faso | 2000 | 11607944 |
Burkina Faso | 2001 | 11946080 |
Burkina Faso | 2002 | 12296399 |
Burkina Faso | 2003 | 12659086 |
Burkina Faso | 2004 | 13034258 |
Burkina Faso | 2005 | 13421929 |
Burkina Faso | 2006 | 13822257 |
Burkina Faso | 2007 | 14235075 |
Burkina Faso | 2008 | 14659646 |
Burkina Faso | 2009 | 15094967 |
Burkina Faso | 2010 | 15540284 |
Burkina Faso | 2011 | 15995313 |
Burkina Faso | 2012 | 16460141 |
Burkina Faso | 2013 | 16934839 |
Burundi | 1995 | 6209923 |
Burundi | 1996 | 6294482 |
Burundi | 1997 | 6369573 |
Burundi | 1998 | 6447672 |
Burundi | 1999 | 6545273 |
Burundi | 2000 | 6674286 |
Burundi | 2001 | 6839376 |
Burundi | 2002 | 7037727 |
Burundi | 2003 | 7264340 |
Burundi | 2004 | 7510771 |
Burundi | 2005 | 7770392 |
Burundi | 2006 | 8042579 |
Burundi | 2007 | 8328312 |
Burundi | 2008 | 8624280 |
Burundi | 2009 | 8926687 |
Burundi | 2010 | 9232753 |
Burundi | 2011 | 9540362 |
Burundi | 2012 | 9849569 |
Burundi | 2013 | 10162532 |
Cabo Verde | 1995 | 399477 |
Cabo Verde | 1996 | 408790 |
Cabo Verde | 1997 | 417562 |
Cabo Verde | 1998 | 425932 |
Cabo Verde | 1999 | 434168 |
Cabo Verde | 2000 | 442426 |
Cabo Verde | 2001 | 450812 |
Cabo Verde | 2002 | 459140 |
Cabo Verde | 2003 | 466939 |
Cabo Verde | 2004 | 473577 |
Cabo Verde | 2005 | 478651 |
Cabo Verde | 2006 | 481940 |
Cabo Verde | 2007 | 483713 |
Cabo Verde | 2008 | 484651 |
Cabo Verde | 2009 | 485714 |
Cabo Verde | 2010 | 487601 |
Cabo Verde | 2011 | 490556 |
Cabo Verde | 2012 | 494401 |
Cabo Verde | 2013 | 498897 |
Cambodia | 1995 | 10769198 |
Cambodia | 1996 | 11090611 |
Cambodia | 1997 | 11395958 |
Cambodia | 1998 | 11685332 |
Cambodia | 1999 | 11960467 |
Cambodia | 2000 | 12222871 |
Cambodia | 2001 | 12472586 |
Cambodia | 2002 | 12709336 |
Cambodia | 2003 | 12934369 |
Cambodia | 2004 | 13149386 |
Cambodia | 2005 | 13356424 |
Cambodia | 2006 | 13555054 |
Cambodia | 2007 | 13747288 |
Cambodia | 2008 | 13940518 |
Cambodia | 2009 | 14144225 |
Cambodia | 2010 | 14364931 |
Cambodia | 2011 | 14605862 |
Cambodia | 2012 | 14864646 |
Cambodia | 2013 | 15135169 |
Cameroon | 1995 | 13929575 |
Cameroon | 1996 | 14316949 |
Cameroon | 1997 | 14709426 |
Cameroon | 1998 | 15107909 |
Cameroon | 1999 | 15513653 |
Cameroon | 2000 | 15927713 |
Cameroon | 2001 | 16350440 |
Cameroon | 2002 | 16782044 |
Cameroon | 2003 | 17223277 |
Cameroon | 2004 | 17674960 |
Cameroon | 2005 | 18137734 |
Cameroon | 2006 | 18611937 |
Cameroon | 2007 | 19097676 |
Cameroon | 2008 | 19595026 |
Cameroon | 2009 | 20103945 |
Cameroon | 2010 | 20624343 |
Cameroon | 2011 | 21156272 |
Cameroon | 2012 | 21699631 |
Cameroon | 2013 | 22253959 |
Canada | 1995 | 29294899 |
Canada | 1996 | 29586368 |
Canada | 1997 | 29866502 |
Canada | 1998 | 30140562 |
Canada | 1999 | 30415664 |
Canada | 2000 | 30697425 |
Canada | 2001 | 30986788 |
Canada | 2002 | 31283746 |
Canada | 2003 | 31591631 |
Canada | 2004 | 31914080 |
Canada | 2005 | 32253092 |
Canada | 2006 | 32610984 |
Canada | 2007 | 32985806 |
Canada | 2008 | 33369898 |
Canada | 2009 | 33752618 |
Canada | 2010 | 34126240 |
Canada | 2011 | 34487414 |
Canada | 2012 | 34837978 |
Canada | 2013 | 35181704 |
Cayman Islands | 1995 | 31672 |
Cayman Islands | 1996 | 33535 |
Cayman Islands | 1997 | 35596 |
Cayman Islands | 1998 | 37742 |
Cayman Islands | 1999 | 39810 |
Cayman Islands | 2000 | 41685 |
Cayman Islands | 2001 | 43317 |
Cayman Islands | 2002 | 44742 |
Cayman Islands | 2003 | 46032 |
Cayman Islands | 2004 | 47299 |
Cayman Islands | 2005 | 48623 |
Cayman Islands | 2006 | 50026 |
Cayman Islands | 2007 | 51472 |
Cayman Islands | 2008 | 52912 |
Cayman Islands | 2009 | 54275 |
Cayman Islands | 2010 | 55509 |
Cayman Islands | 2011 | 56601 |
Cayman Islands | 2012 | 57570 |
Cayman Islands | 2013 | 58435 |
Central African Republic | 1995 | 3275695 |
Central African Republic | 1996 | 3350299 |
Central African Republic | 1997 | 3424733 |
Central African Republic | 1998 | 3498140 |
Central African Republic | 1999 | 3569523 |
Central African Republic | 2000 | 3638316 |
Central African Republic | 2001 | 3704045 |
Central African Republic | 2002 | 3767248 |
Central African Republic | 2003 | 3829636 |
Central African Republic | 2004 | 3893595 |
Central African Republic | 2005 | 3960897 |
Central African Republic | 2006 | 4032102 |
Central African Republic | 2007 | 4106897 |
Central African Republic | 2008 | 4185106 |
Central African Republic | 2009 | 4266247 |
Central African Republic | 2010 | 4349921 |
Central African Republic | 2011 | 4436217 |
Central African Republic | 2012 | 4525209 |
Central African Republic | 2013 | 4616417 |
Chad | 1995 | 6980351 |
Chad | 1996 | 7216321 |
Chad | 1997 | 7463347 |
Chad | 1998 | 7724316 |
Chad | 1999 | 8002899 |
Chad | 2000 | 8301151 |
Chad | 2001 | 8620917 |
Chad | 2002 | 8959964 |
Chad | 2003 | 9311234 |
Chad | 2004 | 9665024 |
Chad | 2005 | 10014413 |
Chad | 2006 | 10356822 |
Chad | 2007 | 10694366 |
Chad | 2008 | 11030628 |
Chad | 2009 | 11371325 |
Chad | 2010 | 11720781 |
Chad | 2011 | 12080037 |
Chad | 2012 | 12448175 |
Chad | 2013 | 12825314 |
Chile | 1995 | 14440103 |
Chile | 1996 | 14662323 |
Chile | 1997 | 14872458 |
Chile | 1998 | 15072409 |
Chile | 1999 | 15265536 |
Chile | 2000 | 15454402 |
Chile | 2001 | 15639289 |
Chile | 2002 | 15819522 |
Chile | 2003 | 15995658 |
Chile | 2004 | 16168241 |
Chile | 2005 | 16337749 |
Chile | 2006 | 16504530 |
Chile | 2007 | 16668892 |
Chile | 2008 | 16831184 |
Chile | 2009 | 16991729 |
Chile | 2010 | 17150760 |
Chile | 2011 | 17308449 |
Chile | 2012 | 17464814 |
Chile | 2013 | 17619708 |
China | 1995 | 1237531429 |
China | 1996 | 1247897092 |
China | 1997 | 1257021784 |
China | 1998 | 1265222536 |
China | 1999 | 1272915272 |
China | 2000 | 1280428583 |
China | 2001 | 1287890449 |
China | 2002 | 1295322020 |
China | 2003 | 1302810258 |
China | 2004 | 1310414386 |
China | 2005 | 1318176835 |
China | 2006 | 1326146433 |
China | 2007 | 1334343509 |
China | 2008 | 1342732604 |
China | 2009 | 1351247555 |
China | 2010 | 1359821465 |
China | 2011 | 1368440300 |
China | 2012 | 1377064907 |
China | 2013 | 1385566537 |
China, Hong Kong SAR | 1995 | 6144498 |
China, Hong Kong SAR | 1996 | 6275363 |
China, Hong Kong SAR | 1997 | 6430651 |
China, Hong Kong SAR | 1998 | 6591717 |
China, Hong Kong SAR | 1999 | 6732627 |
China, Hong Kong SAR | 2000 | 6835301 |
China, Hong Kong SAR | 2001 | 6892752 |
China, Hong Kong SAR | 2002 | 6912079 |
China, Hong Kong SAR | 2003 | 6906631 |
China, Hong Kong SAR | 2004 | 6896523 |
China, Hong Kong SAR | 2005 | 6896686 |
China, Hong Kong SAR | 2006 | 6910671 |
China, Hong Kong SAR | 2007 | 6934748 |
China, Hong Kong SAR | 2008 | 6967866 |
China, Hong Kong SAR | 2009 | 7006930 |
China, Hong Kong SAR | 2010 | 7049514 |
China, Hong Kong SAR | 2011 | 7096359 |
China, Hong Kong SAR | 2012 | 7148493 |
China, Hong Kong SAR | 2013 | 7203836 |
China, Macao SAR | 1995 | 398459 |
China, Macao SAR | 1996 | 405231 |
China, Macao SAR | 1997 | 412031 |
China, Macao SAR | 1998 | 418810 |
China, Macao SAR | 1999 | 425448 |
China, Macao SAR | 2000 | 431907 |
China, Macao SAR | 2001 | 438080 |
China, Macao SAR | 2002 | 444150 |
China, Macao SAR | 2003 | 450711 |
China, Macao SAR | 2004 | 458542 |
China, Macao SAR | 2005 | 468149 |
China, Macao SAR | 2006 | 479808 |
China, Macao SAR | 2007 | 493206 |
China, Macao SAR | 2008 | 507528 |
China, Macao SAR | 2009 | 521617 |
China, Macao SAR | 2010 | 534626 |
China, Macao SAR | 2011 | 546278 |
China, Macao SAR | 2012 | 556783 |
China, Macao SAR | 2013 | 566375 |
Colombia | 1995 | 36573895 |
Colombia | 1996 | 37236124 |
Colombia | 1997 | 37901358 |
Colombia | 1998 | 38568056 |
Colombia | 1999 | 39234115 |
Colombia | 2000 | 39897984 |
Colombia | 2001 | 40558648 |
Colombia | 2002 | 41216304 |
Colombia | 2003 | 41872051 |
Colombia | 2004 | 42527623 |
Colombia | 2005 | 43184026 |
Colombia | 2006 | 43841370 |
Colombia | 2007 | 44498390 |
Colombia | 2008 | 45153037 |
Colombia | 2009 | 45802561 |
Colombia | 2010 | 46444798 |
Colombia | 2011 | 47078792 |
Colombia | 2012 | 47704427 |
Colombia | 2013 | 48321405 |
Comoros | 1995 | 465895 |
Comoros | 1996 | 477548 |
Comoros | 1997 | 489627 |
Comoros | 1998 | 502128 |
Comoros | 1999 | 515028 |
Comoros | 2000 | 528312 |
Comoros | 2001 | 541976 |
Comoros | 2002 | 556028 |
Comoros | 2003 | 570491 |
Comoros | 2004 | 585389 |
Comoros | 2005 | 600733 |
Comoros | 2006 | 616526 |
Comoros | 2007 | 632736 |
Comoros | 2008 | 649291 |
Comoros | 2009 | 666097 |
Comoros | 2010 | 683081 |
Comoros | 2011 | 700216 |
Comoros | 2012 | 717503 |
Comoros | 2013 | 734917 |
Congo | 1995 | 2720633 |
Congo | 1996 | 2797572 |
Congo | 1997 | 2878333 |
Congo | 1998 | 2961357 |
Congo | 1999 | 3044444 |
Congo | 2000 | 3126204 |
Congo | 2001 | 3205636 |
Congo | 2002 | 3283719 |
Congo | 2003 | 3363418 |
Congo | 2004 | 3448868 |
Congo | 2005 | 3542867 |
Congo | 2006 | 3646653 |
Congo | 2007 | 3758858 |
Congo | 2008 | 3876475 |
Congo | 2009 | 3995146 |
Congo | 2010 | 4111715 |
Congo | 2011 | 4225359 |
Congo | 2012 | 4337051 |
Congo | 2013 | 4447632 |
Cook Islands | 1995 | 18305 |
Cook Islands | 1996 | 18244 |
Cook Islands | 1997 | 18093 |
Cook Islands | 1998 | 17915 |
Cook Islands | 1999 | 17806 |
Cook Islands | 2000 | 17826 |
Cook Islands | 2001 | 18003 |
Cook Islands | 2002 | 18308 |
Cook Islands | 2003 | 18690 |
Cook Islands | 2004 | 19072 |
Cook Islands | 2005 | 19399 |
Cook Islands | 2006 | 19656 |
Cook Islands | 2007 | 19858 |
Cook Islands | 2008 | 20016 |
Cook Islands | 2009 | 20153 |
Cook Islands | 2010 | 20284 |
Cook Islands | 2011 | 20409 |
Cook Islands | 2012 | 20523 |
Cook Islands | 2013 | 20629 |
Costa Rica | 1995 | 3478197 |
Costa Rica | 1996 | 3566605 |
Costa Rica | 1997 | 3658020 |
Costa Rica | 1998 | 3750585 |
Costa Rica | 1999 | 3841734 |
Costa Rica | 2000 | 3929588 |
Costa Rica | 2001 | 4013488 |
Costa Rica | 2002 | 4093840 |
Costa Rica | 2003 | 4171145 |
Costa Rica | 2004 | 4246336 |
Costa Rica | 2005 | 4320130 |
Costa Rica | 2006 | 4392493 |
Costa Rica | 2007 | 4463226 |
Costa Rica | 2008 | 4532711 |
Costa Rica | 2009 | 4601424 |
Costa Rica | 2010 | 4669685 |
Costa Rica | 2011 | 4737680 |
Costa Rica | 2012 | 4805295 |
Costa Rica | 2013 | 4872166 |
Côte d’Ivoire | 1995 | 14217430 |
Côte d’Ivoire | 1996 | 14632391 |
Côte d’Ivoire | 1997 | 15042149 |
Côte d’Ivoire | 1998 | 15436470 |
Côte d’Ivoire | 1999 | 15802248 |
Côte d’Ivoire | 2000 | 16131332 |
Côte d’Ivoire | 2001 | 16420173 |
Côte d’Ivoire | 2002 | 16674987 |
Côte d’Ivoire | 2003 | 16909801 |
Côte d’Ivoire | 2004 | 17144325 |
Côte d’Ivoire | 2005 | 17393994 |
Côte d’Ivoire | 2006 | 17662417 |
Côte d’Ivoire | 2007 | 17949061 |
Côte d’Ivoire | 2008 | 18260044 |
Côte d’Ivoire | 2009 | 18601342 |
Côte d’Ivoire | 2010 | 18976588 |
Côte d’Ivoire | 2011 | 19389954 |
Côte d’Ivoire | 2012 | 19839750 |
Côte d’Ivoire | 2013 | 20316086 |
Croatia | 1995 | 4690192 |
Croatia | 1996 | 4647843 |
Croatia | 1997 | 4601596 |
Croatia | 1998 | 4554877 |
Croatia | 1999 | 4511766 |
Croatia | 2000 | 4475201 |
Croatia | 2001 | 4446789 |
Croatia | 2002 | 4426098 |
Croatia | 2003 | 4411370 |
Croatia | 2004 | 4399706 |
Croatia | 2005 | 4388857 |
Croatia | 2006 | 4378601 |
Croatia | 2007 | 4369337 |
Croatia | 2008 | 4360126 |
Croatia | 2009 | 4349930 |
Croatia | 2010 | 4338027 |
Croatia | 2011 | 4323822 |
Croatia | 2012 | 4307422 |
Croatia | 2013 | 4289714 |
Cuba | 1995 | 10932013 |
Cuba | 1996 | 10980758 |
Cuba | 1997 | 11024249 |
Cuba | 1998 | 11063917 |
Cuba | 1999 | 11101580 |
Cuba | 2000 | 11138416 |
Cuba | 2001 | 11175465 |
Cuba | 2002 | 11212125 |
Cuba | 2003 | 11245926 |
Cuba | 2004 | 11273363 |
Cuba | 2005 | 11292078 |
Cuba | 2006 | 11301100 |
Cuba | 2007 | 11301674 |
Cuba | 2008 | 11296355 |
Cuba | 2009 | 11288826 |
Cuba | 2010 | 11281768 |
Cuba | 2011 | 11276053 |
Cuba | 2012 | 11270957 |
Cuba | 2013 | 11265629 |
Curaçao | 2010 | 147560 |
Curaçao | 2011 | 151523 |
Curaçao | 2012 | 155293 |
Curaçao | 2013 | 158760 |
Cyprus | 1995 | 855389 |
Cyprus | 1996 | 873246 |
Cyprus | 1997 | 890733 |
Cyprus | 1998 | 908040 |
Cyprus | 1999 | 925491 |
Cyprus | 2000 | 943287 |
Cyprus | 2001 | 961481 |
Cyprus | 2002 | 979877 |
Cyprus | 2003 | 998142 |
Cyprus | 2004 | 1015820 |
Cyprus | 2005 | 1032586 |
Cyprus | 2006 | 1048314 |
Cyprus | 2007 | 1063095 |
Cyprus | 2008 | 1077089 |
Cyprus | 2009 | 1090553 |
Cyprus | 2010 | 1103685 |
Cyprus | 2011 | 1116513 |
Cyprus | 2012 | 1128994 |
Cyprus | 2013 | 1141166 |
Czech Republic | 1995 | 10339223 |
Czech Republic | 1996 | 10327823 |
Czech Republic | 1997 | 10311228 |
Czech Republic | 1998 | 10291153 |
Czech Republic | 1999 | 10270096 |
Czech Republic | 2000 | 10250398 |
Czech Republic | 2001 | 10231435 |
Czech Republic | 2002 | 10214070 |
Czech Republic | 2003 | 10203846 |
Czech Republic | 2004 | 10207862 |
Czech Republic | 2005 | 10230683 |
Czech Republic | 2006 | 10274906 |
Czech Republic | 2007 | 10337782 |
Czech Republic | 2008 | 10411836 |
Czech Republic | 2009 | 10486434 |
Czech Republic | 2010 | 10553701 |
Czech Republic | 2011 | 10611037 |
Czech Republic | 2012 | 10660051 |
Czech Republic | 2013 | 10702197 |
Democratic People’s Republic of Korea | 1995 | 21763678 |
Democratic People’s Republic of Korea | 1996 | 22016518 |
Democratic People’s Republic of Korea | 1997 | 22240833 |
Democratic People’s Republic of Korea | 1998 | 22444993 |
Democratic People’s Republic of Korea | 1999 | 22641754 |
Democratic People’s Republic of Korea | 2000 | 22840225 |
Democratic People’s Republic of Korea | 2001 | 23043449 |
Democratic People’s Republic of Korea | 2002 | 23248059 |
Democratic People’s Republic of Korea | 2003 | 23449180 |
Democratic People’s Republic of Korea | 2004 | 23639303 |
Democratic People’s Republic of Korea | 2005 | 23813333 |
Democratic People’s Republic of Korea | 2006 | 23969917 |
Democratic People’s Republic of Korea | 2007 | 24111989 |
Democratic People’s Republic of Korea | 2008 | 24243894 |
Democratic People’s Republic of Korea | 2009 | 24371865 |
Democratic People’s Republic of Korea | 2010 | 24500520 |
Democratic People’s Republic of Korea | 2011 | 24631291 |
Democratic People’s Republic of Korea | 2012 | 24763188 |
Democratic People’s Republic of Korea | 2013 | 24895480 |
Democratic Republic of the Congo | 1995 | 42012524 |
Democratic Republic of the Congo | 1996 | 43122601 |
Democratic Republic of the Congo | 1997 | 44078397 |
Democratic Republic of the Congo | 1998 | 44960941 |
Democratic Republic of the Congo | 1999 | 45889100 |
Democratic Republic of the Congo | 2000 | 46949244 |
Democratic Republic of the Congo | 2001 | 48167045 |
Democratic Republic of the Congo | 2002 | 49516960 |
Democratic Republic of the Congo | 2003 | 50972323 |
Democratic Republic of the Congo | 2004 | 52487293 |
Democratic Republic of the Congo | 2005 | 54028003 |
Democratic Republic of the Congo | 2006 | 55590838 |
Democratic Republic of the Congo | 2007 | 57187942 |
Democratic Republic of the Congo | 2008 | 58819038 |
Democratic Republic of the Congo | 2009 | 60486276 |
Democratic Republic of the Congo | 2010 | 62191161 |
Democratic Republic of the Congo | 2011 | 63931512 |
Democratic Republic of the Congo | 2012 | 65705093 |
Democratic Republic of the Congo | 2013 | 67513677 |
Denmark | 1995 | 5232582 |
Denmark | 1996 | 5254383 |
Denmark | 1997 | 5276683 |
Denmark | 1998 | 5298680 |
Denmark | 1999 | 5319410 |
Denmark | 2000 | 5338283 |
Denmark | 2001 | 5354684 |
Denmark | 2002 | 5368994 |
Denmark | 2003 | 5382853 |
Denmark | 2004 | 5398558 |
Denmark | 2005 | 5417692 |
Denmark | 2006 | 5440923 |
Denmark | 2007 | 5467551 |
Denmark | 2008 | 5496104 |
Denmark | 2009 | 5524427 |
Denmark | 2010 | 5550959 |
Denmark | 2011 | 5575237 |
Denmark | 2012 | 5597760 |
Denmark | 2013 | 5619096 |
Djibouti | 1995 | 663999 |
Djibouti | 1996 | 675891 |
Djibouti | 1997 | 687897 |
Djibouti | 1998 | 699922 |
Djibouti | 1999 | 711652 |
Djibouti | 2000 | 722887 |
Djibouti | 2001 | 733732 |
Djibouti | 2002 | 744434 |
Djibouti | 2003 | 755085 |
Djibouti | 2004 | 765776 |
Djibouti | 2005 | 776585 |
Djibouti | 2006 | 787544 |
Djibouti | 2007 | 798690 |
Djibouti | 2008 | 810100 |
Djibouti | 2009 | 821865 |
Djibouti | 2010 | 834036 |
Djibouti | 2011 | 846646 |
Djibouti | 2012 | 859652 |
Djibouti | 2013 | 872932 |
Dominica | 1995 | 71367 |
Dominica | 1996 | 71146 |
Dominica | 1997 | 70756 |
Dominica | 1998 | 70295 |
Dominica | 1999 | 69902 |
Dominica | 2000 | 69679 |
Dominica | 2001 | 69660 |
Dominica | 2002 | 69806 |
Dominica | 2003 | 70058 |
Dominica | 2004 | 70325 |
Dominica | 2005 | 70542 |
Dominica | 2006 | 70690 |
Dominica | 2007 | 70795 |
Dominica | 2008 | 70883 |
Dominica | 2009 | 70996 |
Dominica | 2010 | 71167 |
Dominica | 2011 | 71401 |
Dominica | 2012 | 71684 |
Dominica | 2013 | 72003 |
Dominican Republic | 1995 | 7977966 |
Dominican Republic | 1996 | 8118570 |
Dominican Republic | 1997 | 8256496 |
Dominican Republic | 1998 | 8392534 |
Dominican Republic | 1999 | 8527881 |
Dominican Republic | 2000 | 8663421 |
Dominican Republic | 2001 | 8799298 |
Dominican Republic | 2002 | 8935261 |
Dominican Republic | 2003 | 9071318 |
Dominican Republic | 2004 | 9207389 |
Dominican Republic | 2005 | 9343362 |
Dominican Republic | 2006 | 9479269 |
Dominican Republic | 2007 | 9615015 |
Dominican Republic | 2008 | 9750195 |
Dominican Republic | 2009 | 9884265 |
Dominican Republic | 2010 | 10016797 |
Dominican Republic | 2011 | 10147598 |
Dominican Republic | 2012 | 10276621 |
Dominican Republic | 2013 | 10403761 |
Ecuador | 1995 | 11315800 |
Ecuador | 1996 | 11557151 |
Ecuador | 1997 | 11799289 |
Ecuador | 1998 | 12042454 |
Ecuador | 1999 | 12286995 |
Ecuador | 2000 | 12533087 |
Ecuador | 2001 | 12780869 |
Ecuador | 2002 | 13030041 |
Ecuador | 2003 | 13279806 |
Ecuador | 2004 | 13529091 |
Ecuador | 2005 | 13777131 |
Ecuador | 2006 | 14023503 |
Ecuador | 2007 | 14268397 |
Ecuador | 2008 | 14512402 |
Ecuador | 2009 | 14756424 |
Ecuador | 2010 | 15001072 |
Ecuador | 2011 | 15246481 |
Ecuador | 2012 | 15492264 |
Ecuador | 2013 | 15737878 |
Egypt | 1995 | 61168397 |
Egypt | 1996 | 62123592 |
Egypt | 1997 | 63094069 |
Egypt | 1998 | 64084443 |
Egypt | 1999 | 65097777 |
Egypt | 2000 | 66136590 |
Egypt | 2001 | 67204189 |
Egypt | 2002 | 68302914 |
Egypt | 2003 | 69432477 |
Egypt | 2004 | 70591288 |
Egypt | 2005 | 71777678 |
Egypt | 2006 | 72990754 |
Egypt | 2007 | 74229577 |
Egypt | 2008 | 75491922 |
Egypt | 2009 | 76775023 |
Egypt | 2010 | 78075705 |
Egypt | 2011 | 79392466 |
Egypt | 2012 | 80721874 |
Egypt | 2013 | 82056378 |
El Salvador | 1995 | 5748013 |
El Salvador | 1996 | 5806750 |
El Salvador | 1997 | 5855226 |
El Salvador | 1998 | 5895018 |
El Salvador | 1999 | 5928809 |
El Salvador | 2000 | 5958794 |
El Salvador | 2001 | 5985299 |
El Salvador | 2002 | 6008308 |
El Salvador | 2003 | 6029366 |
El Salvador | 2004 | 6050297 |
El Salvador | 2005 | 6072538 |
El Salvador | 2006 | 6096692 |
El Salvador | 2007 | 6122952 |
El Salvador | 2008 | 6151776 |
El Salvador | 2009 | 6183484 |
El Salvador | 2010 | 6218195 |
El Salvador | 2011 | 6256242 |
El Salvador | 2012 | 6297394 |
El Salvador | 2013 | 6340454 |
Equatorial Guinea | 1995 | 441829 |
Equatorial Guinea | 1996 | 456389 |
Equatorial Guinea | 1997 | 471288 |
Equatorial Guinea | 1998 | 486542 |
Equatorial Guinea | 1999 | 502169 |
Equatorial Guinea | 2000 | 518179 |
Equatorial Guinea | 2001 | 534592 |
Equatorial Guinea | 2002 | 551399 |
Equatorial Guinea | 2003 | 568552 |
Equatorial Guinea | 2004 | 585983 |
Equatorial Guinea | 2005 | 603648 |
Equatorial Guinea | 2006 | 621517 |
Equatorial Guinea | 2007 | 639618 |
Equatorial Guinea | 2008 | 658025 |
Equatorial Guinea | 2009 | 676851 |
Equatorial Guinea | 2010 | 696167 |
Equatorial Guinea | 2011 | 715996 |
Equatorial Guinea | 2012 | 736296 |
Equatorial Guinea | 2013 | 757014 |
Eritrea | 1995 | 3407812 |
Eritrea | 1996 | 3473399 |
Eritrea | 1997 | 3560353 |
Eritrea | 1998 | 3668350 |
Eritrea | 1999 | 3795384 |
Eritrea | 2000 | 3939348 |
Eritrea | 2001 | 4101609 |
Eritrea | 2002 | 4281576 |
Eritrea | 2003 | 4472533 |
Eritrea | 2004 | 4665522 |
Eritrea | 2005 | 4854066 |
Eritrea | 2006 | 5035036 |
Eritrea | 2007 | 5209846 |
Eritrea | 2008 | 5382163 |
Eritrea | 2009 | 5557889 |
Eritrea | 2010 | 5741159 |
Eritrea | 2011 | 5932852 |
Eritrea | 2012 | 6130922 |
Eritrea | 2013 | 6333135 |
Estonia | 1995 | 1433076 |
Estonia | 1996 | 1412522 |
Estonia | 1997 | 1397071 |
Estonia | 1998 | 1385531 |
Estonia | 1999 | 1375744 |
Estonia | 2000 | 1366117 |
Estonia | 2001 | 1356549 |
Estonia | 2002 | 1347674 |
Estonia | 2003 | 1339453 |
Estonia | 2004 | 1331928 |
Estonia | 2005 | 1325112 |
Estonia | 2006 | 1318893 |
Estonia | 2007 | 1313138 |
Estonia | 2008 | 1307827 |
Estonia | 2009 | 1302965 |
Estonia | 2010 | 1298533 |
Estonia | 2011 | 1294498 |
Estonia | 2012 | 1290778 |
Estonia | 2013 | 1287251 |
Ethiopia | 1995 | 57023519 |
Ethiopia | 1996 | 58815116 |
Ethiopia | 1997 | 60584273 |
Ethiopia | 1998 | 62353942 |
Ethiopia | 1999 | 64158887 |
Ethiopia | 2000 | 66024199 |
Ethiopia | 2001 | 67956866 |
Ethiopia | 2002 | 69948344 |
Ethiopia | 2003 | 71989666 |
Ethiopia | 2004 | 74066147 |
Ethiopia | 2005 | 76167240 |
Ethiopia | 2006 | 78290649 |
Ethiopia | 2007 | 80440708 |
Ethiopia | 2008 | 82621190 |
Ethiopia | 2009 | 84838032 |
Ethiopia | 2010 | 87095281 |
Ethiopia | 2011 | 89393063 |
Ethiopia | 2012 | 91728849 |
Ethiopia | 2013 | 94100756 |
Fiji | 1995 | 775587 |
Fiji | 1996 | 784647 |
Fiji | 1997 | 793098 |
Fiji | 1998 | 800616 |
Fiji | 1999 | 806857 |
Fiji | 2000 | 811647 |
Fiji | 2001 | 814700 |
Fiji | 2002 | 816237 |
Fiji | 2003 | 817224 |
Fiji | 2004 | 818995 |
Fiji | 2005 | 822484 |
Fiji | 2006 | 828060 |
Fiji | 2007 | 835392 |
Fiji | 2008 | 843851 |
Fiji | 2009 | 852479 |
Fiji | 2010 | 860559 |
Fiji | 2011 | 867921 |
Fiji | 2012 | 874742 |
Fiji | 2013 | 881065 |
Finland | 1995 | 5108176 |
Finland | 1996 | 5126021 |
Finland | 1997 | 5140755 |
Finland | 1998 | 5153229 |
Finland | 1999 | 5164780 |
Finland | 2000 | 5176482 |
Finland | 2001 | 5188330 |
Finland | 2002 | 5200259 |
Finland | 2003 | 5213213 |
Finland | 2004 | 5228340 |
Finland | 2005 | 5246368 |
Finland | 2006 | 5267817 |
Finland | 2007 | 5292261 |
Finland | 2008 | 5318297 |
Finland | 2009 | 5343927 |
Finland | 2010 | 5367693 |
Finland | 2011 | 5389084 |
Finland | 2012 | 5408466 |
Finland | 2013 | 5426323 |
France | 1995 | 58008958 |
France | 1996 | 58216225 |
France | 1997 | 58418324 |
France | 1998 | 58635564 |
France | 1999 | 58894671 |
France | 2000 | 59213096 |
France | 2001 | 59600714 |
France | 2002 | 60047743 |
France | 2003 | 60527640 |
France | 2004 | 61002537 |
France | 2005 | 61444972 |
France | 2006 | 61845239 |
France | 2007 | 62210877 |
France | 2008 | 62552614 |
France | 2009 | 62888318 |
France | 2010 | 63230866 |
France | 2011 | 63582112 |
France | 2012 | 63936575 |
France | 2013 | 64291280 |
French Polynesia | 1995 | 215200 |
French Polynesia | 1996 | 219282 |
French Polynesia | 1997 | 223734 |
French Polynesia | 1998 | 228380 |
French Polynesia | 1999 | 232956 |
French Polynesia | 2000 | 237267 |
French Polynesia | 2001 | 241276 |
French Polynesia | 2002 | 245032 |
French Polynesia | 2003 | 248536 |
French Polynesia | 2004 | 251811 |
French Polynesia | 2005 | 254884 |
French Polynesia | 2006 | 257731 |
French Polynesia | 2007 | 260361 |
French Polynesia | 2008 | 262877 |
French Polynesia | 2009 | 265412 |
French Polynesia | 2010 | 268065 |
French Polynesia | 2011 | 270874 |
French Polynesia | 2012 | 273814 |
French Polynesia | 2013 | 276831 |
Gabon | 1995 | 1080477 |
Gabon | 1996 | 1108698 |
Gabon | 1997 | 1137412 |
Gabon | 1998 | 1166525 |
Gabon | 1999 | 1195919 |
Gabon | 2000 | 1225527 |
Gabon | 2001 | 1255299 |
Gabon | 2002 | 1285318 |
Gabon | 2003 | 1315820 |
Gabon | 2004 | 1347125 |
Gabon | 2005 | 1379465 |
Gabon | 2006 | 1412907 |
Gabon | 2007 | 1447388 |
Gabon | 2008 | 1482843 |
Gabon | 2009 | 1519155 |
Gabon | 2010 | 1556222 |
Gabon | 2011 | 1594034 |
Gabon | 2012 | 1632572 |
Gabon | 2013 | 1671711 |
Gambia | 1995 | 1065746 |
Gambia | 1996 | 1095930 |
Gambia | 1997 | 1126986 |
Gambia | 1998 | 1159271 |
Gambia | 1999 | 1193143 |
Gambia | 2000 | 1228863 |
Gambia | 2001 | 1266691 |
Gambia | 2002 | 1306667 |
Gambia | 2003 | 1348548 |
Gambia | 2004 | 1391934 |
Gambia | 2005 | 1436549 |
Gambia | 2006 | 1482324 |
Gambia | 2007 | 1529406 |
Gambia | 2008 | 1577984 |
Gambia | 2009 | 1628332 |
Gambia | 2010 | 1680640 |
Gambia | 2011 | 1734966 |
Gambia | 2012 | 1791225 |
Gambia | 2013 | 1849285 |
Georgia | 1995 | 5067143 |
Georgia | 1996 | 4990097 |
Georgia | 1997 | 4922489 |
Georgia | 1998 | 4861848 |
Georgia | 1999 | 4803312 |
Georgia | 2000 | 4743591 |
Georgia | 2001 | 4682290 |
Georgia | 2002 | 4621837 |
Georgia | 2003 | 4564938 |
Georgia | 2004 | 4515280 |
Georgia | 2005 | 4475306 |
Georgia | 2006 | 4446032 |
Georgia | 2007 | 4426077 |
Georgia | 2008 | 4412502 |
Georgia | 2009 | 4401093 |
Georgia | 2010 | 4388674 |
Georgia | 2011 | 4374226 |
Georgia | 2012 | 4358242 |
Georgia | 2013 | 4340895 |
Germany | 1995 | 83147770 |
Germany | 1996 | 83388930 |
Germany | 1997 | 83490697 |
Germany | 1998 | 83500716 |
Germany | 1999 | 83490881 |
Germany | 2000 | 83512459 |
Germany | 2001 | 83583461 |
Germany | 2002 | 83685160 |
Germany | 2003 | 83788480 |
Germany | 2004 | 83848844 |
Germany | 2005 | 83835978 |
Germany | 2006 | 83740302 |
Germany | 2007 | 83578794 |
Germany | 2008 | 83379538 |
Germany | 2009 | 83182774 |
Germany | 2010 | 83017404 |
Germany | 2011 | 82892904 |
Germany | 2012 | 82800121 |
Germany | 2013 | 82726626 |
Ghana | 1995 | 16760926 |
Ghana | 1996 | 17169151 |
Ghana | 1997 | 17568461 |
Ghana | 1998 | 17968830 |
Ghana | 1999 | 18384302 |
Ghana | 2000 | 18825034 |
Ghana | 2001 | 19293392 |
Ghana | 2002 | 19786307 |
Ghana | 2003 | 20301686 |
Ghana | 2004 | 20835514 |
Ghana | 2005 | 21384034 |
Ghana | 2006 | 21947779 |
Ghana | 2007 | 22525659 |
Ghana | 2008 | 23110139 |
Ghana | 2009 | 23691533 |
Ghana | 2010 | 24262901 |
Ghana | 2011 | 24820706 |
Ghana | 2012 | 25366462 |
Ghana | 2013 | 25904598 |
Greece | 1995 | 10671809 |
Greece | 1996 | 10758368 |
Greece | 1997 | 10833632 |
Greece | 1998 | 10896763 |
Greece | 1999 | 10947724 |
Greece | 2000 | 10986883 |
Greece | 2001 | 11012931 |
Greece | 2002 | 11026358 |
Greece | 2003 | 11031728 |
Greece | 2004 | 11035302 |
Greece | 2005 | 11041642 |
Greece | 2006 | 11052514 |
Greece | 2007 | 11066884 |
Greece | 2008 | 11083063 |
Greece | 2009 | 11098149 |
Greece | 2010 | 11109999 |
Greece | 2011 | 11118556 |
Greece | 2012 | 11124639 |
Greece | 2013 | 11127990 |
Greenland | 1995 | 55809 |
Greenland | 1996 | 55832 |
Greenland | 1997 | 55876 |
Greenland | 1998 | 55948 |
Greenland | 1999 | 56049 |
Greenland | 2000 | 56174 |
Greenland | 2001 | 56337 |
Greenland | 2002 | 56534 |
Greenland | 2003 | 56732 |
Greenland | 2004 | 56881 |
Greenland | 2005 | 56953 |
Greenland | 2006 | 56925 |
Greenland | 2007 | 56817 |
Greenland | 2008 | 56675 |
Greenland | 2009 | 56569 |
Greenland | 2010 | 56546 |
Greenland | 2011 | 56626 |
Greenland | 2012 | 56787 |
Greenland | 2013 | 56987 |
Grenada | 1995 | 100253 |
Grenada | 1996 | 100796 |
Grenada | 1997 | 101125 |
Grenada | 1998 | 101302 |
Grenada | 1999 | 101441 |
Grenada | 2000 | 101620 |
Grenada | 2001 | 101849 |
Grenada | 2002 | 102099 |
Grenada | 2003 | 102369 |
Grenada | 2004 | 102655 |
Grenada | 2005 | 102951 |
Grenada | 2006 | 103260 |
Grenada | 2007 | 103586 |
Grenada | 2008 | 103932 |
Grenada | 2009 | 104296 |
Grenada | 2010 | 104677 |
Grenada | 2011 | 105074 |
Grenada | 2012 | 105483 |
Grenada | 2013 | 105897 |
Guam | 1995 | 145562 |
Guam | 1996 | 148060 |
Guam | 1997 | 150306 |
Guam | 1998 | 152275 |
Guam | 1999 | 153951 |
Guam | 2000 | 155328 |
Guam | 2001 | 156417 |
Guam | 2002 | 157241 |
Guam | 2003 | 157823 |
Guam | 2004 | 158194 |
Guam | 2005 | 158401 |
Guam | 2006 | 158429 |
Guam | 2007 | 158331 |
Guam | 2008 | 158310 |
Guam | 2009 | 158621 |
Guam | 2010 | 159440 |
Guam | 2011 | 160858 |
Guam | 2012 | 162810 |
Guam | 2013 | 165124 |
Guatemala | 1995 | 9983861 |
Guatemala | 1996 | 10214623 |
Guatemala | 1997 | 10449636 |
Guatemala | 1998 | 10691090 |
Guatemala | 1999 | 10941913 |
Guatemala | 2000 | 11204183 |
Guatemala | 2001 | 11478984 |
Guatemala | 2002 | 11765738 |
Guatemala | 2003 | 12062835 |
Guatemala | 2004 | 12367800 |
Guatemala | 2005 | 12678919 |
Guatemala | 2006 | 12995374 |
Guatemala | 2007 | 13317931 |
Guatemala | 2008 | 13648307 |
Guatemala | 2009 | 13988988 |
Guatemala | 2010 | 14341576 |
Guatemala | 2011 | 14706578 |
Guatemala | 2012 | 15082831 |
Guatemala | 2013 | 15468203 |
Guinea | 1995 | 7837173 |
Guinea | 1996 | 8094751 |
Guinea | 1997 | 8296478 |
Guinea | 1998 | 8457221 |
Guinea | 1999 | 8600911 |
Guinea | 2000 | 8746128 |
Guinea | 2001 | 8895353 |
Guinea | 2002 | 9045748 |
Guinea | 2003 | 9204581 |
Guinea | 2004 | 9379621 |
Guinea | 2005 | 9576331 |
Guinea | 2006 | 9798963 |
Guinea | 2007 | 10046967 |
Guinea | 2008 | 10314678 |
Guinea | 2009 | 10593248 |
Guinea | 2010 | 10876033 |
Guinea | 2011 | 11161530 |
Guinea | 2012 | 11451273 |
Guinea | 2013 | 11745189 |
Guinea-Bissau | 1995 | 1139667 |
Guinea-Bissau | 1996 | 1165465 |
Guinea-Bissau | 1997 | 1191672 |
Guinea-Bissau | 1998 | 1218336 |
Guinea-Bissau | 1999 | 1245530 |
Guinea-Bissau | 2000 | 1273312 |
Guinea-Bissau | 2001 | 1301748 |
Guinea-Bissau | 2002 | 1330849 |
Guinea-Bissau | 2003 | 1360559 |
Guinea-Bissau | 2004 | 1390791 |
Guinea-Bissau | 2005 | 1421515 |
Guinea-Bissau | 2006 | 1452659 |
Guinea-Bissau | 2007 | 1484337 |
Guinea-Bissau | 2008 | 1516920 |
Guinea-Bissau | 2009 | 1550905 |
Guinea-Bissau | 2010 | 1586624 |
Guinea-Bissau | 2011 | 1624228 |
Guinea-Bissau | 2012 | 1663558 |
Guinea-Bissau | 2013 | 1704255 |
Guyana | 1995 | 728136 |
Guyana | 1996 | 730865 |
Guyana | 1997 | 734059 |
Guyana | 1998 | 737526 |
Guyana | 1999 | 741046 |
Guyana | 2000 | 744471 |
Guyana | 2001 | 747657 |
Guyana | 2002 | 750629 |
Guyana | 2003 | 753612 |
Guyana | 2004 | 756939 |
Guyana | 2005 | 760834 |
Guyana | 2006 | 765367 |
Guyana | 2007 | 770407 |
Guyana | 2008 | 775739 |
Guyana | 2009 | 781055 |
Guyana | 2010 | 786126 |
Guyana | 2011 | 790882 |
Guyana | 2012 | 795369 |
Guyana | 2013 | 799613 |
Haiti | 1995 | 7838241 |
Haiti | 1996 | 7986858 |
Haiti | 1997 | 8136372 |
Haiti | 1998 | 8285690 |
Haiti | 1999 | 8433339 |
Haiti | 2000 | 8578234 |
Haiti | 2001 | 8720247 |
Haiti | 2002 | 8859635 |
Haiti | 2003 | 8996229 |
Haiti | 2004 | 9129933 |
Haiti | 2005 | 9260879 |
Haiti | 2006 | 9388642 |
Haiti | 2007 | 9513714 |
Haiti | 2008 | 9638255 |
Haiti | 2009 | 9765153 |
Haiti | 2010 | 9896400 |
Haiti | 2011 | 10032864 |
Haiti | 2012 | 10173775 |
Haiti | 2013 | 10317461 |
Honduras | 1995 | 5591935 |
Honduras | 1996 | 5723639 |
Honduras | 1997 | 5852719 |
Honduras | 1998 | 5980152 |
Honduras | 1999 | 6107385 |
Honduras | 2000 | 6235561 |
Honduras | 2001 | 6365040 |
Honduras | 2002 | 6495801 |
Honduras | 2003 | 6628171 |
Honduras | 2004 | 6762426 |
Honduras | 2005 | 6898825 |
Honduras | 2006 | 7037428 |
Honduras | 2007 | 7178436 |
Honduras | 2008 | 7322368 |
Honduras | 2009 | 7469844 |
Honduras | 2010 | 7621204 |
Honduras | 2011 | 7776669 |
Honduras | 2012 | 7935846 |
Honduras | 2013 | 8097688 |
Hungary | 1995 | 10351994 |
Hungary | 1996 | 10334876 |
Hungary | 1997 | 10311227 |
Hungary | 1998 | 10282937 |
Hungary | 1999 | 10253110 |
Hungary | 2000 | 10224113 |
Hungary | 2001 | 10196130 |
Hungary | 2002 | 10168591 |
Hungary | 2003 | 10142243 |
Hungary | 2004 | 10117872 |
Hungary | 2005 | 10095964 |
Hungary | 2006 | 10077017 |
Hungary | 2007 | 10060786 |
Hungary | 2008 | 10046058 |
Hungary | 2009 | 10031096 |
Hungary | 2010 | 10014633 |
Hungary | 2011 | 9996227 |
Hungary | 2012 | 9976195 |
Hungary | 2013 | 9954941 |
Iceland | 1995 | 267454 |
Iceland | 1996 | 270089 |
Iceland | 1997 | 272798 |
Iceland | 1998 | 275568 |
Iceland | 1999 | 278376 |
Iceland | 2000 | 281214 |
Iceland | 2001 | 284056 |
Iceland | 2002 | 286929 |
Iceland | 2003 | 289925 |
Iceland | 2004 | 293170 |
Iceland | 2005 | 296745 |
Iceland | 2006 | 300693 |
Iceland | 2007 | 304957 |
Iceland | 2008 | 309394 |
Iceland | 2009 | 313804 |
Iceland | 2010 | 318042 |
Iceland | 2011 | 322052 |
Iceland | 2012 | 325867 |
Iceland | 2013 | 329535 |
India | 1995 | 955804355 |
India | 1996 | 973147577 |
India | 1997 | 990460131 |
India | 1998 | 1007746556 |
India | 1999 | 1025014711 |
India | 2000 | 1042261758 |
India | 2001 | 1059500888 |
India | 2002 | 1076705723 |
India | 2003 | 1093786762 |
India | 2004 | 1110626108 |
India | 2005 | 1127143548 |
India | 2006 | 1143289350 |
India | 2007 | 1159095250 |
India | 2008 | 1174662334 |
India | 2009 | 1190138069 |
India | 2010 | 1205624648 |
India | 2011 | 1221156319 |
India | 2012 | 1236686732 |
India | 2013 | 1252139596 |
Indonesia | 1995 | 194112556 |
Indonesia | 1996 | 197097887 |
Indonesia | 1997 | 200050444 |
Indonesia | 1998 | 202990922 |
Indonesia | 1999 | 205946831 |
Indonesia | 2000 | 208938698 |
Indonesia | 2001 | 211970371 |
Indonesia | 2002 | 215038285 |
Indonesia | 2003 | 218145617 |
Indonesia | 2004 | 221293797 |
Indonesia | 2005 | 224480901 |
Indonesia | 2006 | 227709821 |
Indonesia | 2007 | 230972808 |
Indonesia | 2008 | 234243489 |
Indonesia | 2009 | 237486894 |
Indonesia | 2010 | 240676485 |
Indonesia | 2011 | 243801639 |
Indonesia | 2012 | 246864191 |
Indonesia | 2013 | 249865631 |
Iran (Islamic Republic of) | 1995 | 60468352 |
Iran (Islamic Republic of) | 1996 | 61440887 |
Iran (Islamic Republic of) | 1997 | 62542531 |
Iran (Islamic Republic of) | 1998 | 63713397 |
Iran (Islamic Republic of) | 1999 | 64858754 |
Iran (Islamic Republic of) | 2000 | 65911052 |
Iran (Islamic Republic of) | 2001 | 66857624 |
Iran (Islamic Republic of) | 2002 | 67727274 |
Iran (Islamic Republic of) | 2003 | 68543171 |
Iran (Islamic Republic of) | 2004 | 69342126 |
Iran (Islamic Republic of) | 2005 | 70152384 |
Iran (Islamic Republic of) | 2006 | 70976584 |
Iran (Islamic Republic of) | 2007 | 71809219 |
Iran (Islamic Republic of) | 2008 | 72660887 |
Iran (Islamic Republic of) | 2009 | 73542954 |
Iran (Islamic Republic of) | 2010 | 74462314 |
Iran (Islamic Republic of) | 2011 | 75424285 |
Iran (Islamic Republic of) | 2012 | 76424443 |
Iran (Islamic Republic of) | 2013 | 77447168 |
Iraq | 1995 | 20363138 |
Iraq | 1996 | 21017108 |
Iraq | 1997 | 21693597 |
Iraq | 1998 | 22387179 |
Iraq | 1999 | 23091408 |
Iraq | 2000 | 23801156 |
Iraq | 2001 | 24516842 |
Iraq | 2002 | 25238267 |
Iraq | 2003 | 25959531 |
Iraq | 2004 | 26673536 |
Iraq | 2005 | 27377045 |
Iraq | 2006 | 28064095 |
Iraq | 2007 | 28740630 |
Iraq | 2008 | 29429829 |
Iraq | 2009 | 30163199 |
Iraq | 2010 | 30962380 |
Iraq | 2011 | 31837015 |
Iraq | 2012 | 32778030 |
Iraq | 2013 | 33765232 |
Ireland | 1995 | 3610918 |
Ireland | 1996 | 3638411 |
Ireland | 1997 | 3669799 |
Ireland | 1998 | 3706616 |
Ireland | 1999 | 3750879 |
Ireland | 2000 | 3803741 |
Ireland | 2001 | 3865839 |
Ireland | 2002 | 3935875 |
Ireland | 2003 | 4010652 |
Ireland | 2004 | 4085790 |
Ireland | 2005 | 4158002 |
Ireland | 2006 | 4226104 |
Ireland | 2007 | 4290537 |
Ireland | 2008 | 4351657 |
Ireland | 2009 | 4410422 |
Ireland | 2010 | 4467561 |
Ireland | 2011 | 4522844 |
Ireland | 2012 | 4575890 |
Ireland | 2013 | 4627173 |
Israel | 1995 | 5331622 |
Israel | 1996 | 5486219 |
Israel | 1997 | 5630066 |
Israel | 1998 | 5764197 |
Israel | 1999 | 5891263 |
Israel | 2000 | 6013711 |
Israel | 2001 | 6129590 |
Israel | 2002 | 6238958 |
Israel | 2003 | 6348782 |
Israel | 2004 | 6468354 |
Israel | 2005 | 6603677 |
Israel | 2006 | 6758761 |
Israel | 2007 | 6930068 |
Israel | 2008 | 7106828 |
Israel | 2009 | 7273804 |
Israel | 2010 | 7420368 |
Israel | 2011 | 7542327 |
Israel | 2012 | 7643905 |
Israel | 2013 | 7733144 |
Italy | 1995 | 56967071 |
Italy | 1996 | 56937309 |
Italy | 1997 | 56887127 |
Italy | 1998 | 56850303 |
Italy | 1999 | 56872736 |
Italy | 2000 | 56986085 |
Italy | 2001 | 57200233 |
Italy | 2002 | 57501450 |
Italy | 2003 | 57868021 |
Italy | 2004 | 58267068 |
Italy | 2005 | 58671855 |
Italy | 2006 | 59078271 |
Italy | 2007 | 59485505 |
Italy | 2008 | 59873820 |
Italy | 2009 | 60220314 |
Italy | 2010 | 60508978 |
Italy | 2011 | 60729316 |
Italy | 2012 | 60884593 |
Italy | 2013 | 60990277 |
Jamaica | 1995 | 2462051 |
Jamaica | 1996 | 2485230 |
Jamaica | 1997 | 2509439 |
Jamaica | 1998 | 2534127 |
Jamaica | 1999 | 2558579 |
Jamaica | 2000 | 2582219 |
Jamaica | 2001 | 2604946 |
Jamaica | 2002 | 2626716 |
Jamaica | 2003 | 2647116 |
Jamaica | 2004 | 2665680 |
Jamaica | 2005 | 2682149 |
Jamaica | 2006 | 2696227 |
Jamaica | 2007 | 2708152 |
Jamaica | 2008 | 2718862 |
Jamaica | 2009 | 2729660 |
Jamaica | 2010 | 2741485 |
Jamaica | 2011 | 2754669 |
Jamaica | 2012 | 2768941 |
Jamaica | 2013 | 2783888 |
Japan | 1995 | 124483305 |
Japan | 1996 | 124794906 |
Japan | 1997 | 125048712 |
Japan | 1998 | 125266855 |
Japan | 1999 | 125481436 |
Japan | 2000 | 125714674 |
Japan | 2001 | 125973930 |
Japan | 2002 | 126249090 |
Japan | 2003 | 126523597 |
Japan | 2004 | 126772899 |
Japan | 2005 | 126978754 |
Japan | 2006 | 127136020 |
Japan | 2007 | 127248855 |
Japan | 2008 | 127319434 |
Japan | 2009 | 127352872 |
Japan | 2010 | 127352833 |
Japan | 2011 | 127319206 |
Japan | 2012 | 127249704 |
Japan | 2013 | 127143577 |
Jordan | 1995 | 4320158 |
Jordan | 1996 | 4450852 |
Jordan | 1997 | 4551911 |
Jordan | 1998 | 4630762 |
Jordan | 1999 | 4699278 |
Jordan | 2000 | 4767476 |
Jordan | 2001 | 4835108 |
Jordan | 2002 | 4902974 |
Jordan | 2003 | 4983508 |
Jordan | 2004 | 5092185 |
Jordan | 2005 | 5239417 |
Jordan | 2006 | 5428896 |
Jordan | 2007 | 5655856 |
Jordan | 2008 | 5911202 |
Jordan | 2009 | 6181307 |
Jordan | 2010 | 6454554 |
Jordan | 2011 | 6731151 |
Jordan | 2012 | 7009444 |
Jordan | 2013 | 7273799 |
Kazakhstan | 1995 | 15549632 |
Kazakhstan | 1996 | 15326132 |
Kazakhstan | 1997 | 15085965 |
Kazakhstan | 1998 | 14858241 |
Kazakhstan | 1999 | 14679568 |
Kazakhstan | 2000 | 14575644 |
Kazakhstan | 2001 | 14559255 |
Kazakhstan | 2002 | 14623188 |
Kazakhstan | 2003 | 14747754 |
Kazakhstan | 2004 | 14902452 |
Kazakhstan | 2005 | 15064088 |
Kazakhstan | 2006 | 15227211 |
Kazakhstan | 2007 | 15396045 |
Kazakhstan | 2008 | 15568294 |
Kazakhstan | 2009 | 15743552 |
Kazakhstan | 2010 | 15921127 |
Kazakhstan | 2011 | 16097998 |
Kazakhstan | 2012 | 16271201 |
Kazakhstan | 2013 | 16440586 |
Kenya | 1995 | 27418077 |
Kenya | 1996 | 28186224 |
Kenya | 1997 | 28943647 |
Kenya | 1998 | 29702246 |
Kenya | 1999 | 30478597 |
Kenya | 2000 | 31285050 |
Kenya | 2001 | 32126351 |
Kenya | 2002 | 33000524 |
Kenya | 2003 | 33905011 |
Kenya | 2004 | 34834606 |
Kenya | 2005 | 35785718 |
Kenya | 2006 | 36757498 |
Kenya | 2007 | 37752304 |
Kenya | 2008 | 38773277 |
Kenya | 2009 | 39824734 |
Kenya | 2010 | 40909194 |
Kenya | 2011 | 42027891 |
Kenya | 2012 | 43178141 |
Kenya | 2013 | 44353691 |
Kiribati | 1995 | 76378 |
Kiribati | 1996 | 77511 |
Kiribati | 1997 | 78725 |
Kiribati | 1998 | 80018 |
Kiribati | 1999 | 81377 |
Kiribati | 2000 | 82788 |
Kiribati | 2001 | 84261 |
Kiribati | 2002 | 85799 |
Kiribati | 2003 | 87371 |
Kiribati | 2004 | 88936 |
Kiribati | 2005 | 90468 |
Kiribati | 2006 | 91953 |
Kiribati | 2007 | 93401 |
Kiribati | 2008 | 94832 |
Kiribati | 2009 | 96272 |
Kiribati | 2010 | 97743 |
Kiribati | 2011 | 99250 |
Kiribati | 2012 | 100786 |
Kiribati | 2013 | 102351 |
Kuwait | 1995 | 1586123 |
Kuwait | 1996 | 1585244 |
Kuwait | 1997 | 1635999 |
Kuwait | 1998 | 1722208 |
Kuwait | 1999 | 1818405 |
Kuwait | 2000 | 1906231 |
Kuwait | 2001 | 1980604 |
Kuwait | 2002 | 2048232 |
Kuwait | 2003 | 2116353 |
Kuwait | 2004 | 2196466 |
Kuwait | 2005 | 2296314 |
Kuwait | 2006 | 2417445 |
Kuwait | 2007 | 2554920 |
Kuwait | 2008 | 2702221 |
Kuwait | 2009 | 2850102 |
Kuwait | 2010 | 2991580 |
Kuwait | 2011 | 3124705 |
Kuwait | 2012 | 3250496 |
Kuwait | 2013 | 3368572 |
Kyrgyzstan | 1995 | 4592135 |
Kyrgyzstan | 1996 | 4658815 |
Kyrgyzstan | 1997 | 4739263 |
Kyrgyzstan | 1998 | 4823870 |
Kyrgyzstan | 1999 | 4898865 |
Kyrgyzstan | 2000 | 4954850 |
Kyrgyzstan | 2001 | 4988162 |
Kyrgyzstan | 2002 | 5003394 |
Kyrgyzstan | 2003 | 5009453 |
Kyrgyzstan | 2004 | 5019310 |
Kyrgyzstan | 2005 | 5042381 |
Kyrgyzstan | 2006 | 5081620 |
Kyrgyzstan | 2007 | 5134297 |
Kyrgyzstan | 2008 | 5197274 |
Kyrgyzstan | 2009 | 5265218 |
Kyrgyzstan | 2010 | 5334223 |
Kyrgyzstan | 2011 | 5403419 |
Kyrgyzstan | 2012 | 5474213 |
Kyrgyzstan | 2013 | 5547548 |
Lao People’s Democratic Republic | 1995 | 4871472 |
Lao People’s Democratic Republic | 1996 | 4986592 |
Lao People’s Democratic Republic | 1997 | 5096724 |
Lao People’s Democratic Republic | 1998 | 5200898 |
Lao People’s Democratic Republic | 1999 | 5298146 |
Lao People’s Democratic Republic | 2000 | 5388281 |
Lao People’s Democratic Republic | 2001 | 5470169 |
Lao People’s Democratic Republic | 2002 | 5545245 |
Lao People’s Democratic Republic | 2003 | 5619069 |
Lao People’s Democratic Republic | 2004 | 5699112 |
Lao People’s Democratic Republic | 2005 | 5790646 |
Lao People’s Democratic Republic | 2006 | 5895930 |
Lao People’s Democratic Republic | 2007 | 6013278 |
Lao People’s Democratic Republic | 2008 | 6139127 |
Lao People’s Democratic Republic | 2009 | 6267968 |
Lao People’s Democratic Republic | 2010 | 6395713 |
Lao People’s Democratic Republic | 2011 | 6521314 |
Lao People’s Democratic Republic | 2012 | 6645827 |
Lao People’s Democratic Republic | 2013 | 6769727 |
Latvia | 1995 | 2487988 |
Latvia | 1996 | 2458305 |
Latvia | 1997 | 2434628 |
Latvia | 1998 | 2414650 |
Latvia | 1999 | 2394521 |
Latvia | 2000 | 2371481 |
Latvia | 2001 | 2345309 |
Latvia | 2002 | 2317261 |
Latvia | 2003 | 2287780 |
Latvia | 2004 | 2257647 |
Latvia | 2005 | 2227559 |
Latvia | 2006 | 2197359 |
Latvia | 2007 | 2167157 |
Latvia | 2008 | 2138258 |
Latvia | 2009 | 2112337 |
Latvia | 2010 | 2090519 |
Latvia | 2011 | 2073385 |
Latvia | 2012 | 2060428 |
Latvia | 2013 | 2050317 |
Lebanon | 1995 | 3033406 |
Lebanon | 1996 | 3070984 |
Lebanon | 1997 | 3092718 |
Lebanon | 1998 | 3114014 |
Lebanon | 1999 | 3156706 |
Lebanon | 2000 | 3235380 |
Lebanon | 2001 | 3357600 |
Lebanon | 2002 | 3515604 |
Lebanon | 2003 | 3690110 |
Lebanon | 2004 | 3853582 |
Lebanon | 2005 | 3986865 |
Lebanon | 2006 | 4079823 |
Lebanon | 2007 | 4139813 |
Lebanon | 2008 | 4186088 |
Lebanon | 2009 | 4246924 |
Lebanon | 2010 | 4341092 |
Lebanon | 2011 | 4478105 |
Lebanon | 2012 | 4647079 |
Lebanon | 2013 | 4821971 |
Lesotho | 1995 | 1753824 |
Lesotho | 1996 | 1779197 |
Lesotho | 1997 | 1801679 |
Lesotho | 1998 | 1821609 |
Lesotho | 1999 | 1839611 |
Lesotho | 2000 | 1856225 |
Lesotho | 2001 | 1871500 |
Lesotho | 2002 | 1885487 |
Lesotho | 2003 | 1898757 |
Lesotho | 2004 | 1912022 |
Lesotho | 2005 | 1925844 |
Lesotho | 2006 | 1940413 |
Lesotho | 2007 | 1955784 |
Lesotho | 2008 | 1972199 |
Lesotho | 2009 | 1989873 |
Lesotho | 2010 | 2008921 |
Lesotho | 2011 | 2029516 |
Lesotho | 2012 | 2051545 |
Lesotho | 2013 | 2074465 |
Liberia | 1995 | 2079921 |
Liberia | 1996 | 2197801 |
Liberia | 1997 | 2365290 |
Liberia | 1998 | 2558085 |
Liberia | 1999 | 2741755 |
Liberia | 2000 | 2891968 |
Liberia | 2001 | 2998770 |
Liberia | 2002 | 3070673 |
Liberia | 2003 | 3124222 |
Liberia | 2004 | 3184643 |
Liberia | 2005 | 3269786 |
Liberia | 2006 | 3384791 |
Liberia | 2007 | 3522294 |
Liberia | 2008 | 3672714 |
Liberia | 2009 | 3821440 |
Liberia | 2010 | 3957990 |
Liberia | 2011 | 4079697 |
Liberia | 2012 | 4190435 |
Liberia | 2013 | 4294077 |
Libya | 1995 | 4747619 |
Libya | 1996 | 4837354 |
Libya | 1997 | 4924347 |
Libya | 1998 | 5009240 |
Libya | 1999 | 5092939 |
Libya | 2000 | 5176185 |
Libya | 2001 | 5258677 |
Libya | 2002 | 5340389 |
Libya | 2003 | 5422612 |
Libya | 2004 | 5507000 |
Libya | 2005 | 5594450 |
Libya | 2006 | 5686475 |
Libya | 2007 | 5782108 |
Libya | 2008 | 5876805 |
Libya | 2009 | 5964325 |
Libya | 2010 | 6040612 |
Libya | 2011 | 6103233 |
Libya | 2012 | 6154623 |
Libya | 2013 | 6201521 |
Lithuania | 1995 | 3628079 |
Lithuania | 1996 | 3606012 |
Lithuania | 1997 | 3583272 |
Lithuania | 1998 | 3558827 |
Lithuania | 1999 | 3530932 |
Lithuania | 2000 | 3498446 |
Lithuania | 2001 | 3461616 |
Lithuania | 2002 | 3421430 |
Lithuania | 2003 | 3378410 |
Lithuania | 2004 | 3333259 |
Lithuania | 2005 | 3286782 |
Lithuania | 2006 | 3238819 |
Lithuania | 2007 | 3190088 |
Lithuania | 2008 | 3143310 |
Lithuania | 2009 | 3101973 |
Lithuania | 2010 | 3068457 |
Lithuania | 2011 | 3043980 |
Lithuania | 2012 | 3027621 |
Lithuania | 2013 | 3016933 |
Luxembourg | 1995 | 408152 |
Luxembourg | 1996 | 414004 |
Luxembourg | 1997 | 419979 |
Luxembourg | 1998 | 425834 |
Luxembourg | 1999 | 431268 |
Luxembourg | 2000 | 436111 |
Luxembourg | 2001 | 440137 |
Luxembourg | 2002 | 443524 |
Luxembourg | 2003 | 446996 |
Luxembourg | 2004 | 451548 |
Luxembourg | 2005 | 457847 |
Luxembourg | 2006 | 466209 |
Luxembourg | 2007 | 476294 |
Luxembourg | 2008 | 487310 |
Luxembourg | 2009 | 498116 |
Luxembourg | 2010 | 507885 |
Luxembourg | 2011 | 516348 |
Luxembourg | 2012 | 523744 |
Luxembourg | 2013 | 530380 |
Madagascar | 1995 | 13452526 |
Madagascar | 1996 | 13882646 |
Madagascar | 1997 | 14329239 |
Madagascar | 1998 | 14790245 |
Madagascar | 1999 | 15262817 |
Madagascar | 2000 | 15744811 |
Madagascar | 2001 | 16235767 |
Madagascar | 2002 | 16736029 |
Madagascar | 2003 | 17245275 |
Madagascar | 2004 | 17763367 |
Madagascar | 2005 | 18290394 |
Madagascar | 2006 | 18826126 |
Madagascar | 2007 | 19371023 |
Madagascar | 2008 | 19926785 |
Madagascar | 2009 | 20495695 |
Madagascar | 2010 | 21079532 |
Madagascar | 2011 | 21678934 |
Madagascar | 2012 | 22293914 |
Madagascar | 2013 | 22924851 |
Malawi | 1995 | 9964065 |
Malawi | 1996 | 10153315 |
Malawi | 1997 | 10404259 |
Malawi | 1998 | 10700180 |
Malawi | 1999 | 11012707 |
Malawi | 2000 | 11321496 |
Malawi | 2001 | 11623166 |
Malawi | 2002 | 11926778 |
Malawi | 2003 | 12238739 |
Malawi | 2004 | 12569091 |
Malawi | 2005 | 12924746 |
Malawi | 2006 | 13307535 |
Malawi | 2007 | 13713758 |
Malawi | 2008 | 14138207 |
Malawi | 2009 | 14573338 |
Malawi | 2010 | 15013694 |
Malawi | 2011 | 15457531 |
Malawi | 2012 | 15906483 |
Malawi | 2013 | 16362567 |
Malaysia | 1995 | 20725374 |
Malaysia | 1996 | 21259831 |
Malaysia | 1997 | 21805835 |
Malaysia | 1998 | 22355057 |
Malaysia | 1999 | 22896048 |
Malaysia | 2000 | 23420751 |
Malaysia | 2001 | 23925742 |
Malaysia | 2002 | 24413795 |
Malaysia | 2003 | 24890654 |
Malaysia | 2004 | 25365089 |
Malaysia | 2005 | 25843466 |
Malaysia | 2006 | 26327098 |
Malaysia | 2007 | 26813819 |
Malaysia | 2008 | 27302348 |
Malaysia | 2009 | 27790324 |
Malaysia | 2010 | 28275835 |
Malaysia | 2011 | 28758968 |
Malaysia | 2012 | 29239927 |
Malaysia | 2013 | 29716965 |
Maldives | 1995 | 244965 |
Maldives | 1996 | 250659 |
Maldives | 1997 | 256347 |
Maldives | 1998 | 261973 |
Maldives | 1999 | 267456 |
Maldives | 2000 | 272745 |
Maldives | 2001 | 277825 |
Maldives | 2002 | 282743 |
Maldives | 2003 | 287594 |
Maldives | 2004 | 292505 |
Maldives | 2005 | 297576 |
Maldives | 2006 | 302825 |
Maldives | 2007 | 308239 |
Maldives | 2008 | 313843 |
Maldives | 2009 | 319660 |
Maldives | 2010 | 325694 |
Maldives | 2011 | 331964 |
Maldives | 2012 | 338442 |
Maldives | 2013 | 345023 |
Mali | 1995 | 8988853 |
Mali | 1996 | 9222157 |
Mali | 1997 | 9462256 |
Mali | 1998 | 9712365 |
Mali | 1999 | 9977308 |
Mali | 2000 | 10260577 |
Mali | 2001 | 10562768 |
Mali | 2002 | 10882662 |
Mali | 2003 | 11219737 |
Mali | 2004 | 11572936 |
Mali | 2005 | 11941258 |
Mali | 2006 | 12325545 |
Mali | 2007 | 12725629 |
Mali | 2008 | 13138299 |
Mali | 2009 | 13559296 |
Mali | 2010 | 13985961 |
Mali | 2011 | 14416737 |
Mali | 2012 | 14853572 |
Mali | 2013 | 15301650 |
Malta | 1995 | 395615 |
Malta | 1996 | 398698 |
Malta | 1997 | 401373 |
Malta | 1998 | 403688 |
Malta | 1999 | 405716 |
Malta | 2000 | 407529 |
Malta | 2001 | 409116 |
Malta | 2002 | 410493 |
Malta | 2003 | 411790 |
Malta | 2004 | 413170 |
Malta | 2005 | 414747 |
Malta | 2006 | 416584 |
Malta | 2007 | 418640 |
Malta | 2008 | 420796 |
Malta | 2009 | 422872 |
Malta | 2010 | 424738 |
Malta | 2011 | 426356 |
Malta | 2012 | 427764 |
Malta | 2013 | 429004 |
Marshall Islands | 1995 | 51020 |
Marshall Islands | 1996 | 51397 |
Marshall Islands | 1997 | 51697 |
Marshall Islands | 1998 | 51922 |
Marshall Islands | 1999 | 52076 |
Marshall Islands | 2000 | 52161 |
Marshall Islands | 2001 | 52184 |
Marshall Islands | 2002 | 52161 |
Marshall Islands | 2003 | 52115 |
Marshall Islands | 2004 | 52074 |
Marshall Islands | 2005 | 52058 |
Marshall Islands | 2006 | 52084 |
Marshall Islands | 2007 | 52150 |
Marshall Islands | 2008 | 52245 |
Marshall Islands | 2009 | 52341 |
Marshall Islands | 2010 | 52428 |
Marshall Islands | 2011 | 52495 |
Marshall Islands | 2012 | 52555 |
Marshall Islands | 2013 | 52634 |
Mauritania | 1995 | 2334388 |
Mauritania | 1996 | 2403805 |
Mauritania | 1997 | 2475726 |
Mauritania | 1998 | 2550307 |
Mauritania | 1999 | 2627739 |
Mauritania | 2000 | 2708095 |
Mauritania | 2001 | 2791403 |
Mauritania | 2002 | 2877431 |
Mauritania | 2003 | 2965667 |
Mauritania | 2004 | 3055425 |
Mauritania | 2005 | 3146164 |
Mauritania | 2006 | 3237713 |
Mauritania | 2007 | 3330037 |
Mauritania | 2008 | 3422901 |
Mauritania | 2009 | 3516077 |
Mauritania | 2010 | 3609420 |
Mauritania | 2011 | 3702763 |
Mauritania | 2012 | 3796141 |
Mauritania | 2013 | 3889880 |
Mauritius | 1995 | 1128676 |
Mauritius | 1996 | 1142191 |
Mauritius | 1997 | 1154701 |
Mauritius | 1998 | 1166070 |
Mauritius | 1999 | 1176227 |
Mauritius | 2000 | 1185143 |
Mauritius | 2001 | 1192719 |
Mauritius | 2002 | 1198972 |
Mauritius | 2003 | 1204161 |
Mauritius | 2004 | 1208653 |
Mauritius | 2005 | 1212752 |
Mauritius | 2006 | 1216518 |
Mauritius | 2007 | 1219976 |
Mauritius | 2008 | 1223336 |
Mauritius | 2009 | 1226841 |
Mauritius | 2010 | 1230659 |
Mauritius | 2011 | 1234910 |
Mauritius | 2012 | 1239557 |
Mauritius | 2013 | 1244403 |
Mexico | 1995 | 95392647 |
Mexico | 1996 | 97201533 |
Mexico | 1997 | 98968558 |
Mexico | 1998 | 100678867 |
Mexico | 1999 | 102316781 |
Mexico | 2000 | 103873607 |
Mexico | 2001 | 105339877 |
Mexico | 2002 | 106723661 |
Mexico | 2003 | 108056312 |
Mexico | 2004 | 109381550 |
Mexico | 2005 | 110731826 |
Mexico | 2006 | 112116694 |
Mexico | 2007 | 113529819 |
Mexico | 2008 | 114968039 |
Mexico | 2009 | 116422752 |
Mexico | 2010 | 117886404 |
Mexico | 2011 | 119361233 |
Mexico | 2012 | 120847477 |
Mexico | 2013 | 122332399 |
Micronesia (Federated States of) | 1995 | 107556 |
Micronesia (Federated States of) | 1996 | 108342 |
Micronesia (Federated States of) | 1997 | 108506 |
Micronesia (Federated States of) | 1998 | 108236 |
Micronesia (Federated States of) | 1999 | 107808 |
Micronesia (Federated States of) | 2000 | 107430 |
Micronesia (Federated States of) | 2001 | 107170 |
Micronesia (Federated States of) | 2002 | 106983 |
Micronesia (Federated States of) | 2003 | 106816 |
Micronesia (Federated States of) | 2004 | 106575 |
Micronesia (Federated States of) | 2005 | 106198 |
Micronesia (Federated States of) | 2006 | 105686 |
Micronesia (Federated States of) | 2007 | 105097 |
Micronesia (Federated States of) | 2008 | 104498 |
Micronesia (Federated States of) | 2009 | 103983 |
Micronesia (Federated States of) | 2010 | 103619 |
Micronesia (Federated States of) | 2011 | 103424 |
Micronesia (Federated States of) | 2012 | 103395 |
Micronesia (Federated States of) | 2013 | 103549 |
Monaco | 1995 | 30700 |
Monaco | 1996 | 30971 |
Monaco | 1997 | 31242 |
Monaco | 1998 | 31517 |
Monaco | 1999 | 31795 |
Monaco | 2000 | 32081 |
Monaco | 2001 | 32366 |
Monaco | 2002 | 32653 |
Monaco | 2003 | 32968 |
Monaco | 2004 | 33346 |
Monaco | 2005 | 33808 |
Monaco | 2006 | 34369 |
Monaco | 2007 | 35013 |
Monaco | 2008 | 35686 |
Monaco | 2009 | 36314 |
Monaco | 2010 | 36845 |
Monaco | 2011 | 37261 |
Monaco | 2012 | 37579 |
Monaco | 2013 | 37831 |
Mongolia | 1995 | 2298063 |
Mongolia | 1996 | 2316598 |
Mongolia | 1997 | 2335723 |
Mongolia | 1998 | 2355618 |
Mongolia | 1999 | 2376197 |
Mongolia | 2000 | 2397473 |
Mongolia | 2001 | 2419669 |
Mongolia | 2002 | 2443231 |
Mongolia | 2003 | 2468595 |
Mongolia | 2004 | 2496248 |
Mongolia | 2005 | 2526502 |
Mongolia | 2006 | 2559496 |
Mongolia | 2007 | 2595068 |
Mongolia | 2008 | 2632834 |
Mongolia | 2009 | 2672223 |
Mongolia | 2010 | 2712738 |
Mongolia | 2011 | 2754209 |
Mongolia | 2012 | 2796484 |
Mongolia | 2013 | 2839073 |
Montenegro | 2005 | 615820 |
Montenegro | 2006 | 616854 |
Montenegro | 2007 | 617800 |
Montenegro | 2008 | 618649 |
Montenegro | 2009 | 619408 |
Montenegro | 2010 | 620078 |
Montenegro | 2011 | 620644 |
Montenegro | 2012 | 621081 |
Montenegro | 2013 | 621383 |
Montserrat | 1995 | 10232 |
Montserrat | 1996 | 9375 |
Montserrat | 1997 | 8217 |
Montserrat | 1998 | 6936 |
Montserrat | 1999 | 5788 |
Montserrat | 2000 | 4956 |
Montserrat | 2001 | 4505 |
Montserrat | 2002 | 4377 |
Montserrat | 2003 | 4474 |
Montserrat | 2004 | 4645 |
Montserrat | 2005 | 4777 |
Montserrat | 2006 | 4846 |
Montserrat | 2007 | 4884 |
Montserrat | 2008 | 4901 |
Montserrat | 2009 | 4918 |
Montserrat | 2010 | 4953 |
Montserrat | 2011 | 5000 |
Montserrat | 2012 | 5046 |
Montserrat | 2013 | 5091 |
Morocco | 1995 | 26833093 |
Morocco | 1996 | 27237150 |
Morocco | 1997 | 27632321 |
Morocco | 1998 | 28013585 |
Morocco | 1999 | 28374203 |
Morocco | 2000 | 28710123 |
Morocco | 2001 | 29021156 |
Morocco | 2002 | 29311443 |
Morocco | 2003 | 29586937 |
Morocco | 2004 | 29855820 |
Morocco | 2005 | 30125445 |
Morocco | 2006 | 30395097 |
Morocco | 2007 | 30667086 |
Morocco | 2008 | 30955151 |
Morocco | 2009 | 31276564 |
Morocco | 2010 | 31642360 |
Morocco | 2011 | 32059424 |
Morocco | 2012 | 32521143 |
Morocco | 2013 | 33008150 |
Mozambique | 1995 | 15981571 |
Mozambique | 1996 | 16463426 |
Mozambique | 1997 | 16914628 |
Mozambique | 1998 | 17350739 |
Mozambique | 1999 | 17798102 |
Mozambique | 2000 | 18275618 |
Mozambique | 2001 | 18785719 |
Mozambique | 2002 | 19319894 |
Mozambique | 2003 | 19873460 |
Mozambique | 2004 | 20438827 |
Mozambique | 2005 | 21010376 |
Mozambique | 2006 | 21587317 |
Mozambique | 2007 | 22171404 |
Mozambique | 2008 | 22762525 |
Mozambique | 2009 | 23361025 |
Mozambique | 2010 | 23967265 |
Mozambique | 2011 | 24581367 |
Mozambique | 2012 | 25203395 |
Mozambique | 2013 | 25833752 |
Myanmar | 1995 | 45329862 |
Myanmar | 1996 | 45991828 |
Myanmar | 1997 | 46664455 |
Myanmar | 1998 | 47321204 |
Myanmar | 1999 | 47925630 |
Myanmar | 2000 | 48453000 |
Myanmar | 2001 | 48894203 |
Myanmar | 2002 | 49261313 |
Myanmar | 2003 | 49577152 |
Myanmar | 2004 | 49875169 |
Myanmar | 2005 | 50181020 |
Myanmar | 2006 | 50500070 |
Myanmar | 2007 | 50828959 |
Myanmar | 2008 | 51174018 |
Myanmar | 2009 | 51540490 |
Myanmar | 2010 | 51931231 |
Myanmar | 2011 | 52350763 |
Myanmar | 2012 | 52797319 |
Myanmar | 2013 | 53259018 |
Namibia | 1995 | 1654214 |
Namibia | 1996 | 1705309 |
Namibia | 1997 | 1757969 |
Namibia | 1998 | 1809719 |
Namibia | 1999 | 1857149 |
Namibia | 2000 | 1897953 |
Namibia | 2001 | 1931282 |
Namibia | 2002 | 1958303 |
Namibia | 2003 | 1981237 |
Namibia | 2004 | 2003320 |
Namibia | 2005 | 2027026 |
Namibia | 2006 | 2052931 |
Namibia | 2007 | 2080700 |
Namibia | 2008 | 2110791 |
Namibia | 2009 | 2143498 |
Namibia | 2010 | 2178967 |
Namibia | 2011 | 2217618 |
Namibia | 2012 | 2259393 |
Namibia | 2013 | 2303315 |
Nauru | 1995 | 9970 |
Nauru | 1996 | 10033 |
Nauru | 1997 | 10056 |
Nauru | 1998 | 10054 |
Nauru | 1999 | 10044 |
Nauru | 2000 | 10042 |
Nauru | 2001 | 10053 |
Nauru | 2002 | 10072 |
Nauru | 2003 | 10096 |
Nauru | 2004 | 10112 |
Nauru | 2005 | 10115 |
Nauru | 2006 | 10104 |
Nauru | 2007 | 10083 |
Nauru | 2008 | 10058 |
Nauru | 2009 | 10037 |
Nauru | 2010 | 10025 |
Nauru | 2011 | 10024 |
Nauru | 2012 | 10032 |
Nauru | 2013 | 10051 |
Nepal | 1995 | 20587157 |
Nepal | 1996 | 21115271 |
Nepal | 1997 | 21647305 |
Nepal | 1998 | 22175431 |
Nepal | 1999 | 22690158 |
Nepal | 2000 | 23184177 |
Nepal | 2001 | 23655119 |
Nepal | 2002 | 24102862 |
Nepal | 2003 | 24525527 |
Nepal | 2004 | 24921910 |
Nepal | 2005 | 25292058 |
Nepal | 2006 | 25634043 |
Nepal | 2007 | 25950022 |
Nepal | 2008 | 26249412 |
Nepal | 2009 | 26544943 |
Nepal | 2010 | 26846016 |
Nepal | 2011 | 27156367 |
Nepal | 2012 | 27474377 |
Nepal | 2013 | 27797457 |
Netherlands Antilles | 1995 | 194332 |
Netherlands Antilles | 1996 | 192128 |
Netherlands Antilles | 1997 | 188609 |
Netherlands Antilles | 1998 | 184455 |
Netherlands Antilles | 1999 | 180623 |
Netherlands Antilles | 2000 | 177838 |
Netherlands Antilles | 2001 | 176280 |
Netherlands Antilles | 2002 | 175823 |
Netherlands Antilles | 2003 | 176517 |
Netherlands Antilles | 2004 | 178328 |
Netherlands Antilles | 2005 | 181195 |
Netherlands Antilles | 2006 | 185182 |
Netherlands Antilles | 2007 | 190229 |
Netherlands Antilles | 2008 | 195970 |
Netherlands Antilles | 2009 | 201921 |
Netherlands | 1995 | 15420000 |
Netherlands | 1996 | 15514794 |
Netherlands | 1997 | 15603344 |
Netherlands | 1998 | 15688091 |
Netherlands | 1999 | 15772758 |
Netherlands | 2000 | 15859863 |
Netherlands | 2001 | 15950214 |
Netherlands | 2002 | 16042368 |
Netherlands | 2003 | 16133907 |
Netherlands | 2004 | 16221364 |
Netherlands | 2005 | 16302242 |
Netherlands | 2006 | 16375813 |
Netherlands | 2007 | 16442848 |
Netherlands | 2008 | 16504193 |
Netherlands | 2009 | 16561282 |
Netherlands | 2010 | 16615243 |
Netherlands | 2011 | 16666206 |
Netherlands | 2012 | 16714018 |
Netherlands | 2013 | 16759229 |
New Caledonia | 1995 | 189220 |
New Caledonia | 1996 | 193493 |
New Caledonia | 1997 | 197726 |
New Caledonia | 1998 | 201899 |
New Caledonia | 1999 | 205997 |
New Caledonia | 2000 | 210010 |
New Caledonia | 2001 | 213919 |
New Caledonia | 2002 | 217720 |
New Caledonia | 2003 | 221432 |
New Caledonia | 2004 | 225088 |
New Caledonia | 2005 | 228714 |
New Caledonia | 2006 | 232317 |
New Caledonia | 2007 | 235889 |
New Caledonia | 2008 | 239429 |
New Caledonia | 2009 | 242926 |
New Caledonia | 2010 | 246379 |
New Caledonia | 2011 | 249786 |
New Caledonia | 2012 | 253155 |
New Caledonia | 2013 | 256496 |
New Zealand | 1995 | 3675060 |
New Zealand | 1996 | 3717342 |
New Zealand | 1997 | 3752131 |
New Zealand | 1998 | 3783470 |
New Zealand | 1999 | 3817367 |
New Zealand | 2000 | 3858032 |
New Zealand | 2001 | 3906817 |
New Zealand | 2002 | 3961937 |
New Zealand | 2003 | 4020706 |
New Zealand | 2004 | 4079075 |
New Zealand | 2005 | 4134117 |
New Zealand | 2006 | 4185020 |
New Zealand | 2007 | 4232734 |
New Zealand | 2008 | 4278186 |
New Zealand | 2009 | 4322941 |
New Zealand | 2010 | 4368136 |
New Zealand | 2011 | 4413923 |
New Zealand | 2012 | 4459852 |
New Zealand | 2013 | 4505761 |
Nicaragua | 1995 | 4659458 |
Nicaragua | 1996 | 4756631 |
Nicaragua | 1997 | 4849272 |
Nicaragua | 1998 | 4937320 |
Nicaragua | 1999 | 5021079 |
Nicaragua | 2000 | 5100920 |
Nicaragua | 2001 | 5176685 |
Nicaragua | 2002 | 5248577 |
Nicaragua | 2003 | 5317878 |
Nicaragua | 2004 | 5386299 |
Nicaragua | 2005 | 5455219 |
Nicaragua | 2006 | 5524927 |
Nicaragua | 2007 | 5595533 |
Nicaragua | 2008 | 5667983 |
Nicaragua | 2009 | 5743329 |
Nicaragua | 2010 | 5822209 |
Nicaragua | 2011 | 5905146 |
Nicaragua | 2012 | 5991733 |
Nicaragua | 2013 | 6080478 |
Niger | 1995 | 9167078 |
Niger | 1996 | 9499605 |
Niger | 1997 | 9849621 |
Niger | 1998 | 10215806 |
Niger | 1999 | 10596258 |
Niger | 2000 | 10989815 |
Niger | 2001 | 11396434 |
Niger | 2002 | 11817297 |
Niger | 2003 | 12254040 |
Niger | 2004 | 12708897 |
Niger | 2005 | 13183798 |
Niger | 2006 | 13679705 |
Niger | 2007 | 14197289 |
Niger | 2008 | 14737895 |
Niger | 2009 | 15302948 |
Niger | 2010 | 15893746 |
Niger | 2011 | 16511462 |
Niger | 2012 | 17157042 |
Niger | 2013 | 17831270 |
Nigeria | 1995 | 108424827 |
Nigeria | 1996 | 111166210 |
Nigeria | 1997 | 113979481 |
Nigeria | 1998 | 116867371 |
Nigeria | 1999 | 119831888 |
Nigeria | 2000 | 122876727 |
Nigeria | 2001 | 126004992 |
Nigeria | 2002 | 129224641 |
Nigeria | 2003 | 132550146 |
Nigeria | 2004 | 135999250 |
Nigeria | 2005 | 139585891 |
Nigeria | 2006 | 143314909 |
Nigeria | 2007 | 147187353 |
Nigeria | 2008 | 151208080 |
Nigeria | 2009 | 155381020 |
Nigeria | 2010 | 159707780 |
Nigeria | 2011 | 164192925 |
Nigeria | 2012 | 168833776 |
Nigeria | 2013 | 173615345 |
Niue | 1995 | 2167 |
Niue | 1996 | 2122 |
Niue | 1997 | 2069 |
Niue | 1998 | 2010 |
Niue | 1999 | 1952 |
Niue | 2000 | 1900 |
Niue | 2001 | 1852 |
Niue | 2002 | 1809 |
Niue | 2003 | 1768 |
Niue | 2004 | 1728 |
Niue | 2005 | 1686 |
Niue | 2006 | 1643 |
Niue | 2007 | 1600 |
Niue | 2008 | 1555 |
Niue | 2009 | 1511 |
Niue | 2010 | 1468 |
Niue | 2011 | 1426 |
Niue | 2012 | 1384 |
Niue | 2013 | 1344 |
Northern Mariana Islands | 1995 | 57518 |
Northern Mariana Islands | 1996 | 60248 |
Northern Mariana Islands | 1997 | 62939 |
Northern Mariana Islands | 1998 | 65374 |
Northern Mariana Islands | 1999 | 67271 |
Northern Mariana Islands | 2000 | 68434 |
Northern Mariana Islands | 2001 | 68817 |
Northern Mariana Islands | 2002 | 68499 |
Northern Mariana Islands | 2003 | 67562 |
Northern Mariana Islands | 2004 | 66143 |
Northern Mariana Islands | 2005 | 64372 |
Northern Mariana Islands | 2006 | 62235 |
Northern Mariana Islands | 2007 | 59792 |
Northern Mariana Islands | 2008 | 57345 |
Northern Mariana Islands | 2009 | 55278 |
Northern Mariana Islands | 2010 | 53860 |
Northern Mariana Islands | 2011 | 53230 |
Northern Mariana Islands | 2012 | 53305 |
Northern Mariana Islands | 2013 | 53855 |
Norway | 1995 | 4359788 |
Norway | 1996 | 4385951 |
Norway | 1997 | 4412958 |
Norway | 1998 | 4440109 |
Norway | 1999 | 4466468 |
Norway | 2000 | 4491572 |
Norway | 2001 | 4514723 |
Norway | 2002 | 4536647 |
Norway | 2003 | 4560013 |
Norway | 2004 | 4588444 |
Norway | 2005 | 4624388 |
Norway | 2006 | 4668989 |
Norway | 2007 | 4721080 |
Norway | 2008 | 4777943 |
Norway | 2009 | 4835629 |
Norway | 2010 | 4891251 |
Norway | 2011 | 4943754 |
Norway | 2012 | 4993875 |
Norway | 2013 | 5042671 |
Oman | 1995 | 2154600 |
Oman | 1996 | 2175998 |
Oman | 1997 | 2177723 |
Oman | 1998 | 2171135 |
Oman | 1999 | 2172287 |
Oman | 2000 | 2192535 |
Oman | 2001 | 2239025 |
Oman | 2002 | 2308409 |
Oman | 2003 | 2389121 |
Oman | 2004 | 2464001 |
Oman | 2005 | 2522325 |
Oman | 2006 | 2554905 |
Oman | 2007 | 2569739 |
Oman | 2008 | 2593523 |
Oman | 2009 | 2663224 |
Oman | 2010 | 2802768 |
Oman | 2011 | 3024774 |
Oman | 2012 | 3314001 |
Oman | 2013 | 3632444 |
Pakistan | 1995 | 126689577 |
Pakistan | 1996 | 130083700 |
Pakistan | 1997 | 133597492 |
Pakistan | 1998 | 137139290 |
Pakistan | 1999 | 140580398 |
Pakistan | 2000 | 143832014 |
Pakistan | 2001 | 146857081 |
Pakistan | 2002 | 149693684 |
Pakistan | 2003 | 152419974 |
Pakistan | 2004 | 155151394 |
Pakistan | 2005 | 157971415 |
Pakistan | 2006 | 160905794 |
Pakistan | 2007 | 163928329 |
Pakistan | 2008 | 167008083 |
Pakistan | 2009 | 170093999 |
Pakistan | 2010 | 173149306 |
Pakistan | 2011 | 176166353 |
Pakistan | 2012 | 179160111 |
Pakistan | 2013 | 182142594 |
Palau | 1995 | 17255 |
Palau | 1996 | 17695 |
Palau | 1997 | 18123 |
Palau | 1998 | 18524 |
Palau | 1999 | 18878 |
Palau | 2000 | 19174 |
Palau | 2001 | 19404 |
Palau | 2002 | 19575 |
Palau | 2003 | 19700 |
Palau | 2004 | 19805 |
Palau | 2005 | 19907 |
Palau | 2006 | 20012 |
Palau | 2007 | 20118 |
Palau | 2008 | 20228 |
Palau | 2009 | 20344 |
Palau | 2010 | 20470 |
Palau | 2011 | 20606 |
Palau | 2012 | 20754 |
Palau | 2013 | 20918 |
Panama | 1995 | 2757004 |
Panama | 1996 | 2814525 |
Panama | 1997 | 2873288 |
Panama | 1998 | 2933100 |
Panama | 1999 | 2993685 |
Panama | 2000 | 3054812 |
Panama | 2001 | 3116409 |
Panama | 2002 | 3178450 |
Panama | 2003 | 3240805 |
Panama | 2004 | 3303335 |
Panama | 2005 | 3365929 |
Panama | 2006 | 3428509 |
Panama | 2007 | 3491034 |
Panama | 2008 | 3553480 |
Panama | 2009 | 3615846 |
Panama | 2010 | 3678128 |
Panama | 2011 | 3740282 |
Panama | 2012 | 3802281 |
Panama | 2013 | 3864170 |
Papua New Guinea | 1995 | 4715929 |
Papua New Guinea | 1996 | 4841020 |
Papua New Guinea | 1997 | 4970823 |
Papua New Guinea | 1998 | 5104516 |
Papua New Guinea | 1999 | 5240941 |
Papua New Guinea | 2000 | 5379226 |
Papua New Guinea | 2001 | 5518971 |
Papua New Guinea | 2002 | 5660267 |
Papua New Guinea | 2003 | 5803302 |
Papua New Guinea | 2004 | 5948461 |
Papua New Guinea | 2005 | 6095959 |
Papua New Guinea | 2006 | 6245797 |
Papua New Guinea | 2007 | 6397623 |
Papua New Guinea | 2008 | 6550877 |
Papua New Guinea | 2009 | 6704829 |
Papua New Guinea | 2010 | 6858945 |
Papua New Guinea | 2011 | 7012977 |
Papua New Guinea | 2012 | 7167010 |
Papua New Guinea | 2013 | 7321262 |
Paraguay | 1995 | 4801834 |
Paraguay | 1996 | 4911701 |
Paraguay | 1997 | 5021271 |
Paraguay | 1998 | 5130723 |
Paraguay | 1999 | 5240321 |
Paraguay | 2000 | 5350253 |
Paraguay | 2001 | 5460621 |
Paraguay | 2002 | 5571371 |
Paraguay | 2003 | 5682350 |
Paraguay | 2004 | 5793330 |
Paraguay | 2005 | 5904170 |
Paraguay | 2006 | 6014781 |
Paraguay | 2007 | 6125285 |
Paraguay | 2008 | 6236005 |
Paraguay | 2009 | 6347383 |
Paraguay | 2010 | 6459721 |
Paraguay | 2011 | 6573097 |
Paraguay | 2012 | 6687361 |
Paraguay | 2013 | 6802295 |
Peru | 1995 | 23939261 |
Peru | 1996 | 24365985 |
Peru | 1997 | 24789855 |
Peru | 1998 | 25206817 |
Peru | 1999 | 25611482 |
Peru | 2000 | 26000080 |
Peru | 2001 | 26372358 |
Peru | 2002 | 26729909 |
Peru | 2003 | 27073334 |
Peru | 2004 | 27403845 |
Peru | 2005 | 27723281 |
Peru | 2006 | 28030688 |
Peru | 2007 | 28328410 |
Peru | 2008 | 28625628 |
Peru | 2009 | 28934303 |
Peru | 2010 | 29262830 |
Peru | 2011 | 29614887 |
Peru | 2012 | 29987800 |
Peru | 2013 | 30375603 |
Philippines | 1995 | 69606539 |
Philippines | 1996 | 71184718 |
Philippines | 1997 | 72780928 |
Philippines | 1998 | 74393147 |
Philippines | 1999 | 76018006 |
Philippines | 2000 | 77651848 |
Philippines | 2001 | 79297756 |
Philippines | 2002 | 80953652 |
Philippines | 2003 | 82604681 |
Philippines | 2004 | 84231329 |
Philippines | 2005 | 85821214 |
Philippines | 2006 | 87366573 |
Philippines | 2007 | 88875548 |
Philippines | 2008 | 90371287 |
Philippines | 2009 | 91886400 |
Philippines | 2010 | 93444322 |
Philippines | 2011 | 95053437 |
Philippines | 2012 | 96706764 |
Philippines | 2013 | 98393574 |
Poland | 1995 | 38479899 |
Poland | 1996 | 38480234 |
Poland | 1997 | 38461279 |
Poland | 1998 | 38428791 |
Poland | 1999 | 38390217 |
Poland | 2000 | 38351437 |
Poland | 2001 | 38314744 |
Poland | 2002 | 38280547 |
Poland | 2003 | 38250426 |
Poland | 2004 | 38225455 |
Poland | 2005 | 38206337 |
Poland | 2006 | 38194163 |
Poland | 2007 | 38189136 |
Poland | 2008 | 38189735 |
Poland | 2009 | 38193591 |
Poland | 2010 | 38198754 |
Poland | 2011 | 38204598 |
Poland | 2012 | 38210924 |
Poland | 2013 | 38216635 |
Portugal | 1995 | 10097055 |
Portugal | 1996 | 10140627 |
Portugal | 1997 | 10182158 |
Portugal | 1998 | 10222540 |
Portugal | 1999 | 10263532 |
Portugal | 2000 | 10306192 |
Portugal | 2001 | 10350660 |
Portugal | 2002 | 10395630 |
Portugal | 2003 | 10439031 |
Portugal | 2004 | 10478122 |
Portugal | 2005 | 10510967 |
Portugal | 2006 | 10536701 |
Portugal | 2007 | 10555902 |
Portugal | 2008 | 10569881 |
Portugal | 2009 | 10580673 |
Portugal | 2010 | 10589792 |
Portugal | 2011 | 10597629 |
Portugal | 2012 | 10603804 |
Portugal | 2013 | 10608156 |
Puerto Rico | 1995 | 3689649 |
Puerto Rico | 1996 | 3719446 |
Puerto Rico | 1997 | 3746634 |
Puerto Rico | 1998 | 3769718 |
Puerto Rico | 1999 | 3786884 |
Puerto Rico | 2000 | 3796981 |
Puerto Rico | 2001 | 3799358 |
Puerto Rico | 2002 | 3794728 |
Puerto Rico | 2003 | 3785058 |
Puerto Rico | 2004 | 3773147 |
Puerto Rico | 2005 | 3761143 |
Puerto Rico | 2006 | 3749763 |
Puerto Rico | 2007 | 3738829 |
Puerto Rico | 2008 | 3728531 |
Puerto Rico | 2009 | 3718812 |
Puerto Rico | 2010 | 3709671 |
Puerto Rico | 2011 | 3701373 |
Puerto Rico | 2012 | 3694237 |
Puerto Rico | 2013 | 3688318 |
Qatar | 1995 | 501154 |
Qatar | 1996 | 512476 |
Qatar | 1997 | 529491 |
Qatar | 1998 | 550367 |
Qatar | 1999 | 572155 |
Qatar | 2000 | 593693 |
Qatar | 2001 | 611808 |
Qatar | 2002 | 629745 |
Qatar | 2003 | 660238 |
Qatar | 2004 | 720383 |
Qatar | 2005 | 821159 |
Qatar | 2006 | 967602 |
Qatar | 2007 | 1152459 |
Qatar | 2008 | 1359114 |
Qatar | 2009 | 1564082 |
Qatar | 2010 | 1749713 |
Qatar | 2011 | 1910902 |
Qatar | 2012 | 2050514 |
Qatar | 2013 | 2168673 |
Republic of Korea | 1995 | 44652994 |
Republic of Korea | 1996 | 44940974 |
Republic of Korea | 1997 | 45220543 |
Republic of Korea | 1998 | 45489131 |
Republic of Korea | 1999 | 45742103 |
Republic of Korea | 2000 | 45977210 |
Republic of Korea | 2001 | 46192932 |
Republic of Korea | 2002 | 46393993 |
Republic of Korea | 2003 | 46591762 |
Republic of Korea | 2004 | 46801310 |
Republic of Korea | 2005 | 47033082 |
Republic of Korea | 2006 | 47291491 |
Republic of Korea | 2007 | 47572585 |
Republic of Korea | 2008 | 47867970 |
Republic of Korea | 2009 | 48164969 |
Republic of Korea | 2010 | 48453931 |
Republic of Korea | 2011 | 48732640 |
Republic of Korea | 2012 | 49002683 |
Republic of Korea | 2013 | 49262698 |
Republic of Moldova | 1995 | 4339081 |
Republic of Moldova | 1996 | 4308050 |
Republic of Moldova | 1997 | 4268774 |
Republic of Moldova | 1998 | 4221726 |
Republic of Moldova | 1999 | 4167552 |
Republic of Moldova | 2000 | 4107184 |
Republic of Moldova | 2001 | 4040579 |
Republic of Moldova | 2002 | 3969040 |
Republic of Moldova | 2003 | 3896494 |
Republic of Moldova | 2004 | 3827963 |
Republic of Moldova | 2005 | 3767077 |
Republic of Moldova | 2006 | 3715541 |
Republic of Moldova | 2007 | 3672638 |
Republic of Moldova | 2008 | 3636510 |
Republic of Moldova | 2009 | 3604078 |
Republic of Moldova | 2010 | 3573024 |
Republic of Moldova | 2011 | 3542928 |
Republic of Moldova | 2012 | 3514381 |
Republic of Moldova | 2013 | 3487204 |
Romania | 1995 | 22963512 |
Romania | 1996 | 22841943 |
Romania | 1997 | 22717415 |
Romania | 1998 | 22596183 |
Romania | 1999 | 22484940 |
Romania | 2000 | 22388354 |
Romania | 2001 | 22310092 |
Romania | 2002 | 22249564 |
Romania | 2003 | 22201592 |
Romania | 2004 | 22158163 |
Romania | 2005 | 22113264 |
Romania | 2006 | 22065409 |
Romania | 2007 | 22015937 |
Romania | 2008 | 21964962 |
Romania | 2009 | 21913311 |
Romania | 2010 | 21861476 |
Romania | 2011 | 21808931 |
Romania | 2012 | 21754741 |
Romania | 2013 | 21698585 |
Russian Federation | 1995 | 148602147 |
Russian Federation | 1996 | 148375246 |
Russian Federation | 1997 | 148079919 |
Russian Federation | 1998 | 147715550 |
Russian Federation | 1999 | 147275875 |
Russian Federation | 2000 | 146762881 |
Russian Federation | 2001 | 146170247 |
Russian Federation | 2002 | 145520813 |
Russian Federation | 2003 | 144879644 |
Russian Federation | 2004 | 144331352 |
Russian Federation | 2005 | 143932966 |
Russian Federation | 2006 | 143715023 |
Russian Federation | 2007 | 143652377 |
Russian Federation | 2008 | 143677033 |
Russian Federation | 2009 | 143689741 |
Russian Federation | 2010 | 143617913 |
Russian Federation | 2011 | 143438152 |
Russian Federation | 2012 | 143169653 |
Russian Federation | 2013 | 142833689 |
Rwanda | 1995 | 5663838 |
Rwanda | 1996 | 5929575 |
Rwanda | 1997 | 6470628 |
Rwanda | 1998 | 7169658 |
Rwanda | 1999 | 7853015 |
Rwanda | 2000 | 8395577 |
Rwanda | 2001 | 8760003 |
Rwanda | 2002 | 8987523 |
Rwanda | 2003 | 9126167 |
Rwanda | 2004 | 9254379 |
Rwanda | 2005 | 9429457 |
Rwanda | 2006 | 9660946 |
Rwanda | 2007 | 9928143 |
Rwanda | 2008 | 10222961 |
Rwanda | 2009 | 10529668 |
Rwanda | 2010 | 10836732 |
Rwanda | 2011 | 11144315 |
Rwanda | 2012 | 11457801 |
Rwanda | 2013 | 11776522 |
Saint Kitts and Nevis | 1995 | 42888 |
Saint Kitts and Nevis | 1996 | 43391 |
Saint Kitts and Nevis | 1997 | 43885 |
Saint Kitts and Nevis | 1998 | 44391 |
Saint Kitts and Nevis | 1999 | 44938 |
Saint Kitts and Nevis | 2000 | 45544 |
Saint Kitts and Nevis | 2001 | 46214 |
Saint Kitts and Nevis | 2002 | 46934 |
Saint Kitts and Nevis | 2003 | 47679 |
Saint Kitts and Nevis | 2004 | 48421 |
Saint Kitts and Nevis | 2005 | 49139 |
Saint Kitts and Nevis | 2006 | 49823 |
Saint Kitts and Nevis | 2007 | 50478 |
Saint Kitts and Nevis | 2008 | 51110 |
Saint Kitts and Nevis | 2009 | 51731 |
Saint Kitts and Nevis | 2010 | 52352 |
Saint Kitts and Nevis | 2011 | 52971 |
Saint Kitts and Nevis | 2012 | 53584 |
Saint Kitts and Nevis | 2013 | 54191 |
Saint Lucia | 1995 | 147040 |
Saint Lucia | 1996 | 148962 |
Saint Lucia | 1997 | 150994 |
Saint Lucia | 1998 | 153066 |
Saint Lucia | 1999 | 155073 |
Saint Lucia | 2000 | 156949 |
Saint Lucia | 2001 | 158650 |
Saint Lucia | 2002 | 160217 |
Saint Lucia | 2003 | 161766 |
Saint Lucia | 2004 | 163460 |
Saint Lucia | 2005 | 165407 |
Saint Lucia | 2006 | 167658 |
Saint Lucia | 2007 | 170149 |
Saint Lucia | 2008 | 172734 |
Saint Lucia | 2009 | 175200 |
Saint Lucia | 2010 | 177397 |
Saint Lucia | 2011 | 179271 |
Saint Lucia | 2012 | 180870 |
Saint Lucia | 2013 | 182273 |
Saint Vincent and the Grenadines | 1995 | 108122 |
Saint Vincent and the Grenadines | 1996 | 108078 |
Saint Vincent and the Grenadines | 1997 | 108001 |
Saint Vincent and the Grenadines | 1998 | 107923 |
Saint Vincent and the Grenadines | 1999 | 107879 |
Saint Vincent and the Grenadines | 2000 | 107897 |
Saint Vincent and the Grenadines | 2001 | 107989 |
Saint Vincent and the Grenadines | 2002 | 108150 |
Saint Vincent and the Grenadines | 2003 | 108353 |
Saint Vincent and the Grenadines | 2004 | 108562 |
Saint Vincent and the Grenadines | 2005 | 108749 |
Saint Vincent and the Grenadines | 2006 | 108908 |
Saint Vincent and the Grenadines | 2007 | 109045 |
Saint Vincent and the Grenadines | 2008 | 109158 |
Saint Vincent and the Grenadines | 2009 | 109249 |
Saint Vincent and the Grenadines | 2010 | 109316 |
Saint Vincent and the Grenadines | 2011 | 109357 |
Saint Vincent and the Grenadines | 2012 | 109373 |
Saint Vincent and the Grenadines | 2013 | 109373 |
Samoa | 1995 | 170158 |
Samoa | 1996 | 171276 |
Samoa | 1997 | 172191 |
Samoa | 1998 | 172979 |
Samoa | 1999 | 173758 |
Samoa | 2000 | 174614 |
Samoa | 2001 | 175567 |
Samoa | 2002 | 176592 |
Samoa | 2003 | 177677 |
Samoa | 2004 | 178794 |
Samoa | 2005 | 179928 |
Samoa | 2006 | 181073 |
Samoa | 2007 | 182240 |
Samoa | 2008 | 183444 |
Samoa | 2009 | 184704 |
Samoa | 2010 | 186029 |
Samoa | 2011 | 187429 |
Samoa | 2012 | 188889 |
Samoa | 2013 | 190372 |
San Marino | 1995 | 25680 |
San Marino | 1996 | 25914 |
San Marino | 1997 | 26114 |
San Marino | 1998 | 26321 |
San Marino | 1999 | 26594 |
San Marino | 2000 | 26969 |
San Marino | 2001 | 27467 |
San Marino | 2002 | 28064 |
San Marino | 2003 | 28700 |
San Marino | 2004 | 29290 |
San Marino | 2005 | 29775 |
San Marino | 2006 | 30130 |
San Marino | 2007 | 30377 |
San Marino | 2008 | 30549 |
San Marino | 2009 | 30698 |
San Marino | 2010 | 30861 |
San Marino | 2011 | 31048 |
San Marino | 2012 | 31247 |
San Marino | 2013 | 31448 |
Sao Tome and Principe | 1995 | 130378 |
Sao Tome and Principe | 1996 | 132323 |
Sao Tome and Principe | 1997 | 134029 |
Sao Tome and Principe | 1998 | 135650 |
Sao Tome and Principe | 1999 | 137396 |
Sao Tome and Principe | 2000 | 139428 |
Sao Tome and Principe | 2001 | 141783 |
Sao Tome and Principe | 2002 | 144447 |
Sao Tome and Principe | 2003 | 147455 |
Sao Tome and Principe | 2004 | 150842 |
Sao Tome and Principe | 2005 | 154615 |
Sao Tome and Principe | 2006 | 158806 |
Sao Tome and Principe | 2007 | 163390 |
Sao Tome and Principe | 2008 | 168253 |
Sao Tome and Principe | 2009 | 173240 |
Sao Tome and Principe | 2010 | 178228 |
Sao Tome and Principe | 2011 | 183177 |
Sao Tome and Principe | 2012 | 188098 |
Sao Tome and Principe | 2013 | 192993 |
Saudi Arabia | 1995 | 18567343 |
Saudi Arabia | 1996 | 18848350 |
Saudi Arabia | 1997 | 19060850 |
Saudi Arabia | 1998 | 19282965 |
Saudi Arabia | 1999 | 19620692 |
Saudi Arabia | 2000 | 20144584 |
Saudi Arabia | 2001 | 20891594 |
Saudi Arabia | 2002 | 21825217 |
Saudi Arabia | 2003 | 22852333 |
Saudi Arabia | 2004 | 23839231 |
Saudi Arabia | 2005 | 24690067 |
Saudi Arabia | 2006 | 25371936 |
Saudi Arabia | 2007 | 25915624 |
Saudi Arabia | 2008 | 26366358 |
Saudi Arabia | 2009 | 26796375 |
Saudi Arabia | 2010 | 27258387 |
Saudi Arabia | 2011 | 27761728 |
Saudi Arabia | 2012 | 28287855 |
Saudi Arabia | 2013 | 28828870 |
Senegal | 1995 | 8711528 |
Senegal | 1996 | 8940298 |
Senegal | 1997 | 9164050 |
Senegal | 1998 | 9387783 |
Senegal | 1999 | 9618564 |
Senegal | 2000 | 9861679 |
Senegal | 2001 | 10119118 |
Senegal | 2002 | 10390050 |
Senegal | 2003 | 10673535 |
Senegal | 2004 | 10967568 |
Senegal | 2005 | 11270826 |
Senegal | 2006 | 11582925 |
Senegal | 2007 | 11904974 |
Senegal | 2008 | 12238791 |
Senegal | 2009 | 12586827 |
Senegal | 2010 | 12950564 |
Senegal | 2011 | 13330737 |
Senegal | 2012 | 13726021 |
Senegal | 2013 | 14133280 |
Serbia & Montenegro | 1995 | 10989446 |
Serbia & Montenegro | 1996 | 11028631 |
Serbia & Montenegro | 1997 | 11025594 |
Serbia & Montenegro | 1998 | 10990409 |
Serbia & Montenegro | 1999 | 10939047 |
Serbia & Montenegro | 2000 | 10883641 |
Serbia & Montenegro | 2001 | 10826817 |
Serbia & Montenegro | 2002 | 10766194 |
Serbia & Montenegro | 2003 | 10703165 |
Serbia & Montenegro | 2004 | 10638276 |
Serbia | 2005 | 9956359 |
Serbia | 2006 | 9889237 |
Serbia | 2007 | 9823743 |
Serbia | 2008 | 9760977 |
Serbia | 2009 | 9701912 |
Serbia | 2010 | 9647109 |
Serbia | 2011 | 9597413 |
Serbia | 2012 | 9552553 |
Serbia | 2013 | 9510506 |
Seychelles | 1995 | 75433 |
Seychelles | 1996 | 76391 |
Seychelles | 1997 | 77173 |
Seychelles | 1998 | 77891 |
Seychelles | 1999 | 78720 |
Seychelles | 2000 | 79774 |
Seychelles | 2001 | 81093 |
Seychelles | 2002 | 82611 |
Seychelles | 2003 | 84218 |
Seychelles | 2004 | 85751 |
Seychelles | 2005 | 87094 |
Seychelles | 2006 | 88210 |
Seychelles | 2007 | 89134 |
Seychelles | 2008 | 89902 |
Seychelles | 2009 | 90577 |
Seychelles | 2010 | 91208 |
Seychelles | 2011 | 91799 |
Seychelles | 2012 | 92339 |
Seychelles | 2013 | 92838 |
Sierra Leone | 1995 | 3927105 |
Sierra Leone | 1996 | 3919708 |
Sierra Leone | 1997 | 3928313 |
Sierra Leone | 1998 | 3961869 |
Sierra Leone | 1999 | 4030443 |
Sierra Leone | 2000 | 4139757 |
Sierra Leone | 2001 | 4295667 |
Sierra Leone | 2002 | 4493047 |
Sierra Leone | 2003 | 4712763 |
Sierra Leone | 2004 | 4928175 |
Sierra Leone | 2005 | 5119895 |
Sierra Leone | 2006 | 5280909 |
Sierra Leone | 2007 | 5416015 |
Sierra Leone | 2008 | 5532139 |
Sierra Leone | 2009 | 5641182 |
Sierra Leone | 2010 | 5751976 |
Sierra Leone | 2011 | 5865491 |
Sierra Leone | 2012 | 5978727 |
Sierra Leone | 2013 | 6092075 |
Singapore | 1995 | 3482640 |
Singapore | 1996 | 3570085 |
Singapore | 1997 | 3653156 |
Singapore | 1998 | 3735537 |
Singapore | 1999 | 3822625 |
Singapore | 2000 | 3918189 |
Singapore | 2001 | 4023284 |
Singapore | 2002 | 4136239 |
Singapore | 2003 | 4254766 |
Singapore | 2004 | 4375413 |
Singapore | 2005 | 4495537 |
Singapore | 2006 | 4614310 |
Singapore | 2007 | 4732065 |
Singapore | 2008 | 4848676 |
Singapore | 2009 | 4964312 |
Singapore | 2010 | 5078969 |
Singapore | 2011 | 5192183 |
Singapore | 2012 | 5303264 |
Singapore | 2013 | 5411737 |
Sint Maarten (Dutch part) | 2010 | 42519 |
Sint Maarten (Dutch part) | 2011 | 43451 |
Sint Maarten (Dutch part) | 2012 | 44355 |
Sint Maarten (Dutch part) | 2013 | 45233 |
Slovakia | 1995 | 5362950 |
Slovakia | 1996 | 5372351 |
Slovakia | 1997 | 5379101 |
Slovakia | 1998 | 5383590 |
Slovakia | 1999 | 5386384 |
Slovakia | 2000 | 5388010 |
Slovakia | 2001 | 5388448 |
Slovakia | 2002 | 5387913 |
Slovakia | 2003 | 5387441 |
Slovakia | 2004 | 5388338 |
Slovakia | 2005 | 5391489 |
Slovakia | 2006 | 5397396 |
Slovakia | 2007 | 5405718 |
Slovakia | 2008 | 5415434 |
Slovakia | 2009 | 5425044 |
Slovakia | 2010 | 5433437 |
Slovakia | 2011 | 5440253 |
Slovakia | 2012 | 5445757 |
Slovakia | 2013 | 5450223 |
Slovenia | 1995 | 1991848 |
Slovenia | 1996 | 1989709 |
Slovenia | 1997 | 1988790 |
Slovenia | 1998 | 1988806 |
Slovenia | 1999 | 1989178 |
Slovenia | 2000 | 1989545 |
Slovenia | 2001 | 1989732 |
Slovenia | 2002 | 1990090 |
Slovenia | 2003 | 1991368 |
Slovenia | 2004 | 1994578 |
Slovenia | 2005 | 2000349 |
Slovenia | 2006 | 2009036 |
Slovenia | 2007 | 2020156 |
Slovenia | 2008 | 2032470 |
Slovenia | 2009 | 2044248 |
Slovenia | 2010 | 2054232 |
Slovenia | 2011 | 2061952 |
Slovenia | 2012 | 2067717 |
Slovenia | 2013 | 2071997 |
Solomon Islands | 1995 | 359236 |
Solomon Islands | 1996 | 369439 |
Solomon Islands | 1997 | 379861 |
Solomon Islands | 1998 | 390493 |
Solomon Islands | 1999 | 401323 |
Solomon Islands | 2000 | 412336 |
Solomon Islands | 2001 | 423529 |
Solomon Islands | 2002 | 434880 |
Solomon Islands | 2003 | 446335 |
Solomon Islands | 2004 | 457827 |
Solomon Islands | 2005 | 469306 |
Solomon Islands | 2006 | 480745 |
Solomon Islands | 2007 | 492148 |
Solomon Islands | 2008 | 503541 |
Solomon Islands | 2009 | 514964 |
Solomon Islands | 2010 | 526447 |
Solomon Islands | 2011 | 537997 |
Solomon Islands | 2012 | 549598 |
Solomon Islands | 2013 | 561231 |
Somalia | 1995 | 6346440 |
Somalia | 1996 | 6481035 |
Somalia | 1997 | 6673254 |
Somalia | 1998 | 6904978 |
Somalia | 1999 | 7149044 |
Somalia | 2000 | 7385416 |
Somalia | 2001 | 7609265 |
Somalia | 2002 | 7825924 |
Somalia | 2003 | 8037706 |
Somalia | 2004 | 8249965 |
Somalia | 2005 | 8466938 |
Somalia | 2006 | 8687671 |
Somalia | 2007 | 8910851 |
Somalia | 2008 | 9140259 |
Somalia | 2009 | 9380854 |
Somalia | 2010 | 9636173 |
Somalia | 2011 | 9907903 |
Somalia | 2012 | 10195134 |
Somalia | 2013 | 10495583 |
South Africa | 1995 | 41426810 |
South Africa | 1996 | 42204043 |
South Africa | 1997 | 42906581 |
South Africa | 1998 | 43558285 |
South Africa | 1999 | 44195890 |
South Africa | 2000 | 44846286 |
South Africa | 2001 | 45513217 |
South Africa | 2002 | 46187794 |
South Africa | 2003 | 46869028 |
South Africa | 2004 | 47553025 |
South Africa | 2005 | 48235291 |
South Africa | 2006 | 48919359 |
South Africa | 2007 | 49602778 |
South Africa | 2008 | 50267488 |
South Africa | 2009 | 50889543 |
South Africa | 2010 | 51452352 |
South Africa | 2011 | 51949041 |
South Africa | 2012 | 52385920 |
South Africa | 2013 | 52776130 |
South Sudan | 2011 | 10381110 |
South Sudan | 2012 | 10837527 |
South Sudan | 2013 | 11296173 |
Spain | 1995 | 39420568 |
Spain | 1996 | 39513721 |
Spain | 1997 | 39603778 |
Spain | 1998 | 39729942 |
Spain | 1999 | 39944692 |
Spain | 2000 | 40282828 |
Spain | 2001 | 40756675 |
Spain | 2002 | 41346738 |
Spain | 2003 | 42015864 |
Spain | 2004 | 42710301 |
Spain | 2005 | 43387477 |
Spain | 2006 | 44038456 |
Spain | 2007 | 44664067 |
Spain | 2008 | 45243381 |
Spain | 2009 | 45754265 |
Spain | 2010 | 46182038 |
Spain | 2011 | 46514117 |
Spain | 2012 | 46754541 |
Spain | 2013 | 46926963 |
Sri Lanka | 1995 | 18241711 |
Sri Lanka | 1996 | 18367795 |
Sri Lanka | 1997 | 18473862 |
Sri Lanka | 1998 | 18575763 |
Sri Lanka | 1999 | 18695041 |
Sri Lanka | 2000 | 18846401 |
Sri Lanka | 2001 | 19037119 |
Sri Lanka | 2002 | 19260853 |
Sri Lanka | 2003 | 19501969 |
Sri Lanka | 2004 | 19737578 |
Sri Lanka | 2005 | 19951291 |
Sri Lanka | 2006 | 20137560 |
Sri Lanka | 2007 | 20301912 |
Sri Lanka | 2008 | 20452387 |
Sri Lanka | 2009 | 20601663 |
Sri Lanka | 2010 | 20758779 |
Sri Lanka | 2011 | 20925532 |
Sri Lanka | 2012 | 21098099 |
Sri Lanka | 2013 | 21273228 |
Sudan | 1995 | 29963988 |
Sudan | 1996 | 30824141 |
Sudan | 1997 | 31682982 |
Sudan | 1998 | 32551853 |
Sudan | 1999 | 33447666 |
Sudan | 2000 | 34382782 |
Sudan | 2001 | 35359265 |
Sudan | 2002 | 36373247 |
Sudan | 2003 | 37423884 |
Sudan | 2004 | 38508752 |
Sudan | 2005 | 39625222 |
Sudan | 2006 | 40774428 |
Sudan | 2007 | 41954986 |
Sudan | 2008 | 43158451 |
Sudan | 2009 | 44373749 |
Sudan | 2010 | 45592931 |
Sudan | 2011 | 36430923 |
Sudan | 2012 | 37195349 |
Sudan | 2013 | 37964306 |
Suriname | 1995 | 435776 |
Suriname | 1996 | 441734 |
Suriname | 1997 | 447771 |
Suriname | 1998 | 453920 |
Suriname | 1999 | 460215 |
Suriname | 2000 | 466668 |
Suriname | 2001 | 473312 |
Suriname | 2002 | 480099 |
Suriname | 2003 | 486867 |
Suriname | 2004 | 493394 |
Suriname | 2005 | 499523 |
Suriname | 2006 | 505186 |
Suriname | 2007 | 510433 |
Suriname | 2008 | 515372 |
Suriname | 2009 | 520173 |
Suriname | 2010 | 524960 |
Suriname | 2011 | 529761 |
Suriname | 2012 | 534541 |
Suriname | 2013 | 539276 |
Swaziland | 1995 | 963428 |
Swaziland | 1996 | 984506 |
Swaziland | 1997 | 1006760 |
Swaziland | 1998 | 1028694 |
Swaziland | 1999 | 1048151 |
Swaziland | 2000 | 1063715 |
Swaziland | 2001 | 1074761 |
Swaziland | 2002 | 1082183 |
Swaziland | 2003 | 1087929 |
Swaziland | 2004 | 1094758 |
Swaziland | 2005 | 1104642 |
Swaziland | 2006 | 1118253 |
Swaziland | 2007 | 1134977 |
Swaziland | 2008 | 1153929 |
Swaziland | 2009 | 1173678 |
Swaziland | 2010 | 1193148 |
Swaziland | 2011 | 1212159 |
Swaziland | 2012 | 1230985 |
Swaziland | 2013 | 1249514 |
Sweden | 1995 | 8826720 |
Sweden | 1996 | 8849420 |
Sweden | 1997 | 8859106 |
Sweden | 1998 | 8861204 |
Sweden | 1999 | 8863595 |
Sweden | 2000 | 8872284 |
Sweden | 2001 | 8888444 |
Sweden | 2002 | 8911156 |
Sweden | 2003 | 8941754 |
Sweden | 2004 | 8981282 |
Sweden | 2005 | 9030163 |
Sweden | 2006 | 9089677 |
Sweden | 2007 | 9159155 |
Sweden | 2008 | 9234561 |
Sweden | 2009 | 9310295 |
Sweden | 2010 | 9382297 |
Sweden | 2011 | 9448965 |
Sweden | 2012 | 9511313 |
Sweden | 2013 | 9571105 |
Switzerland | 1995 | 7017042 |
Switzerland | 1996 | 7059633 |
Switzerland | 1997 | 7090176 |
Switzerland | 1998 | 7113505 |
Switzerland | 1999 | 7136813 |
Switzerland | 2000 | 7165581 |
Switzerland | 2001 | 7200783 |
Switzerland | 2002 | 7241511 |
Switzerland | 2003 | 7289079 |
Switzerland | 2004 | 7344597 |
Switzerland | 2005 | 7408608 |
Switzerland | 2006 | 7482167 |
Switzerland | 2007 | 7564712 |
Switzerland | 2008 | 7653062 |
Switzerland | 2009 | 7742768 |
Switzerland | 2010 | 7830534 |
Switzerland | 2011 | 7915200 |
Switzerland | 2012 | 7997399 |
Switzerland | 2013 | 8077833 |
Syrian Arab Republic | 1995 | 14338240 |
Syrian Arab Republic | 1996 | 14746306 |
Syrian Arab Republic | 1997 | 15168523 |
Syrian Arab Republic | 1998 | 15591261 |
Syrian Arab Republic | 1999 | 15995760 |
Syrian Arab Republic | 2000 | 16371208 |
Syrian Arab Republic | 2001 | 16700984 |
Syrian Arab Republic | 2002 | 16994676 |
Syrian Arab Republic | 2003 | 17298476 |
Syrian Arab Republic | 2004 | 17676012 |
Syrian Arab Republic | 2005 | 18167367 |
Syrian Arab Republic | 2006 | 18804914 |
Syrian Arab Republic | 2007 | 19561477 |
Syrian Arab Republic | 2008 | 20346056 |
Syrian Arab Republic | 2009 | 21031546 |
Syrian Arab Republic | 2010 | 21532647 |
Syrian Arab Republic | 2011 | 21804363 |
Syrian Arab Republic | 2012 | 21889682 |
Syrian Arab Republic | 2013 | 21898061 |
Tajikistan | 1995 | 5784330 |
Tajikistan | 1996 | 5862347 |
Tajikistan | 1997 | 5937177 |
Tajikistan | 1998 | 6012933 |
Tajikistan | 1999 | 6094661 |
Tajikistan | 2000 | 6186152 |
Tajikistan | 2001 | 6289340 |
Tajikistan | 2002 | 6404118 |
Tajikistan | 2003 | 6529609 |
Tajikistan | 2004 | 6663929 |
Tajikistan | 2005 | 6805655 |
Tajikistan | 2006 | 6954522 |
Tajikistan | 2007 | 7111025 |
Tajikistan | 2008 | 7275252 |
Tajikistan | 2009 | 7447396 |
Tajikistan | 2010 | 7627326 |
Tajikistan | 2011 | 7814850 |
Tajikistan | 2012 | 8008990 |
Tajikistan | 2013 | 8207834 |
Thailand | 1995 | 58983954 |
Thailand | 1996 | 59562136 |
Thailand | 1997 | 60206941 |
Thailand | 1998 | 60903042 |
Thailand | 1999 | 61623143 |
Thailand | 2000 | 62343379 |
Thailand | 2001 | 63069070 |
Thailand | 2002 | 63797841 |
Thailand | 2003 | 64488338 |
Thailand | 2004 | 65087400 |
Thailand | 2005 | 65559487 |
Thailand | 2006 | 65883961 |
Thailand | 2007 | 66076927 |
Thailand | 2008 | 66185340 |
Thailand | 2009 | 66277335 |
Thailand | 2010 | 66402316 |
Thailand | 2011 | 66576332 |
Thailand | 2012 | 66785001 |
Thailand | 2013 | 67010502 |
The Former Yugoslav Republic of Macedonia | 1995 | 1967013 |
The Former Yugoslav Republic of Macedonia | 1996 | 1975207 |
The Former Yugoslav Republic of Macedonia | 1997 | 1991687 |
The Former Yugoslav Republic of Macedonia | 1998 | 2013117 |
The Former Yugoslav Republic of Macedonia | 1999 | 2034487 |
The Former Yugoslav Republic of Macedonia | 2000 | 2052129 |
The Former Yugoslav Republic of Macedonia | 2001 | 2065098 |
The Former Yugoslav Republic of Macedonia | 2002 | 2074441 |
The Former Yugoslav Republic of Macedonia | 2003 | 2080866 |
The Former Yugoslav Republic of Macedonia | 2004 | 2085728 |
The Former Yugoslav Republic of Macedonia | 2005 | 2090044 |
The Former Yugoslav Republic of Macedonia | 2006 | 2093801 |
The Former Yugoslav Republic of Macedonia | 2007 | 2096620 |
The Former Yugoslav Republic of Macedonia | 2008 | 2098769 |
The Former Yugoslav Republic of Macedonia | 2009 | 2100558 |
The Former Yugoslav Republic of Macedonia | 2010 | 2102216 |
The Former Yugoslav Republic of Macedonia | 2011 | 2103890 |
The Former Yugoslav Republic of Macedonia | 2012 | 2105575 |
The Former Yugoslav Republic of Macedonia | 2013 | 2107158 |
Timor-Leste | 2002 | 899367 |
Timor-Leste | 2003 | 933369 |
Timor-Leste | 2004 | 966987 |
Timor-Leste | 2005 | 995619 |
Timor-Leste | 2006 | 1018013 |
Timor-Leste | 2007 | 1035706 |
Timor-Leste | 2008 | 1050244 |
Timor-Leste | 2009 | 1064191 |
Timor-Leste | 2010 | 1079450 |
Timor-Leste | 2011 | 1096293 |
Timor-Leste | 2012 | 1114106 |
Timor-Leste | 2013 | 1132879 |
Togo | 1995 | 4284497 |
Togo | 1996 | 4392177 |
Togo | 1997 | 4504291 |
Togo | 1998 | 4620710 |
Togo | 1999 | 4740974 |
Togo | 2000 | 4864753 |
Togo | 2001 | 4992225 |
Togo | 2002 | 5123674 |
Togo | 2003 | 5258956 |
Togo | 2004 | 5397851 |
Togo | 2005 | 5540214 |
Togo | 2006 | 5685845 |
Togo | 2007 | 5834806 |
Togo | 2008 | 5987491 |
Togo | 2009 | 6144457 |
Togo | 2010 | 6306014 |
Togo | 2011 | 6472304 |
Togo | 2012 | 6642928 |
Togo | 2013 | 6816982 |
Tokelau | 1995 | 1520 |
Tokelau | 1996 | 1529 |
Tokelau | 1997 | 1548 |
Tokelau | 1998 | 1566 |
Tokelau | 1999 | 1571 |
Tokelau | 2000 | 1552 |
Tokelau | 2001 | 1504 |
Tokelau | 2002 | 1434 |
Tokelau | 2003 | 1351 |
Tokelau | 2004 | 1272 |
Tokelau | 2005 | 1210 |
Tokelau | 2006 | 1167 |
Tokelau | 2007 | 1141 |
Tokelau | 2008 | 1130 |
Tokelau | 2009 | 1129 |
Tokelau | 2010 | 1135 |
Tokelau | 2011 | 1148 |
Tokelau | 2012 | 1169 |
Tokelau | 2013 | 1195 |
Tonga | 1995 | 95928 |
Tonga | 1996 | 96218 |
Tonga | 1997 | 96574 |
Tonga | 1998 | 96991 |
Tonga | 1999 | 97457 |
Tonga | 2000 | 97962 |
Tonga | 2001 | 98504 |
Tonga | 2002 | 99083 |
Tonga | 2003 | 99691 |
Tonga | 2004 | 100319 |
Tonga | 2005 | 100960 |
Tonga | 2006 | 101617 |
Tonga | 2007 | 102289 |
Tonga | 2008 | 102947 |
Tonga | 2009 | 103557 |
Tonga | 2010 | 104098 |
Tonga | 2011 | 104554 |
Tonga | 2012 | 104941 |
Tonga | 2013 | 105323 |
Trinidad and Tobago | 1995 | 1255001 |
Trinidad and Tobago | 1996 | 1258365 |
Trinidad and Tobago | 1997 | 1260677 |
Trinidad and Tobago | 1998 | 1262544 |
Trinidad and Tobago | 1999 | 1264781 |
Trinidad and Tobago | 2000 | 1267980 |
Trinidad and Tobago | 2001 | 1272347 |
Trinidad and Tobago | 2002 | 1277723 |
Trinidad and Tobago | 2003 | 1283868 |
Trinidad and Tobago | 2004 | 1290379 |
Trinidad and Tobago | 2005 | 1296933 |
Trinidad and Tobago | 2006 | 1303478 |
Trinidad and Tobago | 2007 | 1310040 |
Trinidad and Tobago | 2008 | 1316449 |
Trinidad and Tobago | 2009 | 1322518 |
Trinidad and Tobago | 2010 | 1328095 |
Trinidad and Tobago | 2011 | 1333082 |
Trinidad and Tobago | 2012 | 1337439 |
Trinidad and Tobago | 2013 | 1341151 |
Tunisia | 1995 | 8982649 |
Tunisia | 1996 | 9116617 |
Tunisia | 1997 | 9237249 |
Tunisia | 1998 | 9347451 |
Tunisia | 1999 | 9451481 |
Tunisia | 2000 | 9552776 |
Tunisia | 2001 | 9652120 |
Tunisia | 2002 | 9749636 |
Tunisia | 2003 | 9847323 |
Tunisia | 2004 | 9947369 |
Tunisia | 2005 | 10051352 |
Tunisia | 2006 | 10160243 |
Tunisia | 2007 | 10273932 |
Tunisia | 2008 | 10391460 |
Tunisia | 2009 | 10511204 |
Tunisia | 2010 | 10631830 |
Tunisia | 2011 | 10753073 |
Tunisia | 2012 | 10874915 |
Tunisia | 2013 | 10996515 |
Turkey | 1995 | 58522320 |
Turkey | 1996 | 59442502 |
Turkey | 1997 | 60372413 |
Turkey | 1998 | 61308204 |
Turkey | 1999 | 62243779 |
Turkey | 2000 | 63174483 |
Turkey | 2001 | 64100297 |
Turkey | 2002 | 65022300 |
Turkey | 2003 | 65938265 |
Turkey | 2004 | 66845635 |
Turkey | 2005 | 67743052 |
Turkey | 2006 | 68626337 |
Turkey | 2007 | 69496513 |
Turkey | 2008 | 70363511 |
Turkey | 2009 | 71241080 |
Turkey | 2010 | 72137546 |
Turkey | 2011 | 73058638 |
Turkey | 2012 | 73997128 |
Turkey | 2013 | 74932641 |
Turkmenistan | 1995 | 4188010 |
Turkmenistan | 1996 | 4267690 |
Turkmenistan | 1997 | 4335991 |
Turkmenistan | 1998 | 4395293 |
Turkmenistan | 1999 | 4449427 |
Turkmenistan | 2000 | 4501419 |
Turkmenistan | 2001 | 4551762 |
Turkmenistan | 2002 | 4600171 |
Turkmenistan | 2003 | 4648037 |
Turkmenistan | 2004 | 4696876 |
Turkmenistan | 2005 | 4747839 |
Turkmenistan | 2006 | 4801595 |
Turkmenistan | 2007 | 4858236 |
Turkmenistan | 2008 | 4917543 |
Turkmenistan | 2009 | 4978962 |
Turkmenistan | 2010 | 5041995 |
Turkmenistan | 2011 | 5106668 |
Turkmenistan | 2012 | 5172931 |
Turkmenistan | 2013 | 5240072 |
Turks and Caicos Islands | 1995 | 15334 |
Turks and Caicos Islands | 1996 | 15967 |
Turks and Caicos Islands | 1997 | 16527 |
Turks and Caicos Islands | 1998 | 17114 |
Turks and Caicos Islands | 1999 | 17866 |
Turks and Caicos Islands | 2000 | 18876 |
Turks and Caicos Islands | 2001 | 20186 |
Turks and Caicos Islands | 2002 | 21740 |
Turks and Caicos Islands | 2003 | 23412 |
Turks and Caicos Islands | 2004 | 25025 |
Turks and Caicos Islands | 2005 | 26450 |
Turks and Caicos Islands | 2006 | 27642 |
Turks and Caicos Islands | 2007 | 28638 |
Turks and Caicos Islands | 2008 | 29481 |
Turks and Caicos Islands | 2009 | 30247 |
Turks and Caicos Islands | 2010 | 30993 |
Turks and Caicos Islands | 2011 | 31726 |
Turks and Caicos Islands | 2012 | 32427 |
Turks and Caicos Islands | 2013 | 33098 |
Tuvalu | 1995 | 9227 |
Tuvalu | 1996 | 9264 |
Tuvalu | 1997 | 9298 |
Tuvalu | 1998 | 9334 |
Tuvalu | 1999 | 9374 |
Tuvalu | 2000 | 9419 |
Tuvalu | 2001 | 9471 |
Tuvalu | 2002 | 9530 |
Tuvalu | 2003 | 9590 |
Tuvalu | 2004 | 9646 |
Tuvalu | 2005 | 9694 |
Tuvalu | 2006 | 9732 |
Tuvalu | 2007 | 9764 |
Tuvalu | 2008 | 9788 |
Tuvalu | 2009 | 9808 |
Tuvalu | 2010 | 9827 |
Tuvalu | 2011 | 9844 |
Tuvalu | 2012 | 9860 |
Tuvalu | 2013 | 9876 |
Uganda | 1995 | 20740726 |
Uganda | 1996 | 21407693 |
Uganda | 1997 | 22084527 |
Uganda | 1998 | 22780451 |
Uganda | 1999 | 23507800 |
Uganda | 2000 | 24275641 |
Uganda | 2001 | 25088033 |
Uganda | 2002 | 25943441 |
Uganda | 2003 | 26838428 |
Uganda | 2004 | 27766986 |
Uganda | 2005 | 28724869 |
Uganda | 2006 | 29711397 |
Uganda | 2007 | 30728747 |
Uganda | 2008 | 31778799 |
Uganda | 2009 | 32864328 |
Uganda | 2010 | 33987213 |
Uganda | 2011 | 35148064 |
Uganda | 2012 | 36345860 |
Uganda | 2013 | 37578876 |
Ukraine | 1995 | 51146967 |
Ukraine | 1996 | 50821019 |
Ukraine | 1997 | 50421998 |
Ukraine | 1998 | 49974187 |
Ukraine | 1999 | 49510626 |
Ukraine | 2000 | 49057226 |
Ukraine | 2001 | 48620596 |
Ukraine | 2002 | 48200504 |
Ukraine | 2003 | 47807199 |
Ukraine | 2004 | 47450472 |
Ukraine | 2005 | 47135932 |
Ukraine | 2006 | 46871328 |
Ukraine | 2007 | 46653183 |
Ukraine | 2008 | 46461350 |
Ukraine | 2009 | 46267306 |
Ukraine | 2010 | 46050220 |
Ukraine | 2011 | 45802721 |
Ukraine | 2012 | 45529944 |
Ukraine | 2013 | 45238805 |
United Arab Emirates | 1995 | 2346305 |
United Arab Emirates | 1996 | 2470810 |
United Arab Emirates | 1997 | 2608993 |
United Arab Emirates | 1998 | 2753498 |
United Arab Emirates | 1999 | 2893648 |
United Arab Emirates | 2000 | 3026352 |
United Arab Emirates | 2001 | 3132104 |
United Arab Emirates | 2002 | 3223969 |
United Arab Emirates | 2003 | 3369254 |
United Arab Emirates | 2004 | 3658658 |
United Arab Emirates | 2005 | 4148883 |
United Arab Emirates | 2006 | 4875639 |
United Arab Emirates | 2007 | 5797347 |
United Arab Emirates | 2008 | 6798635 |
United Arab Emirates | 2009 | 7718319 |
United Arab Emirates | 2010 | 8441537 |
United Arab Emirates | 2011 | 8925096 |
United Arab Emirates | 2012 | 9205651 |
United Arab Emirates | 2013 | 9346129 |
United Kingdom of Great Britain and Northern Ireland | 1995 | 57997197 |
United Kingdom of Great Britain and Northern Ireland | 1996 | 58168519 |
United Kingdom of Great Britain and Northern Ireland | 1997 | 58346633 |
United Kingdom of Great Britain and Northern Ireland | 1998 | 58534306 |
United Kingdom of Great Britain and Northern Ireland | 1999 | 58735006 |
United Kingdom of Great Britain and Northern Ireland | 2000 | 58951444 |
United Kingdom of Great Britain and Northern Ireland | 2001 | 59183774 |
United Kingdom of Great Britain and Northern Ireland | 2002 | 59431937 |
United Kingdom of Great Britain and Northern Ireland | 2003 | 59697954 |
United Kingdom of Great Britain and Northern Ireland | 2004 | 59984118 |
United Kingdom of Great Britain and Northern Ireland | 2005 | 60291414 |
United Kingdom of Great Britain and Northern Ireland | 2006 | 60620907 |
United Kingdom of Great Britain and Northern Ireland | 2007 | 60970360 |
United Kingdom of Great Britain and Northern Ireland | 2008 | 61333257 |
United Kingdom of Great Britain and Northern Ireland | 2009 | 61700797 |
United Kingdom of Great Britain and Northern Ireland | 2010 | 62066350 |
United Kingdom of Great Britain and Northern Ireland | 2011 | 62426923 |
United Kingdom of Great Britain and Northern Ireland | 2012 | 62783115 |
United Kingdom of Great Britain and Northern Ireland | 2013 | 63136265 |
United Republic of Tanzania | 1995 | 29944302 |
United Republic of Tanzania | 1996 | 30780453 |
United Republic of Tanzania | 1997 | 31586039 |
United Republic of Tanzania | 1998 | 32378333 |
United Republic of Tanzania | 1999 | 33183093 |
United Republic of Tanzania | 2000 | 34020512 |
United Republic of Tanzania | 2001 | 34895398 |
United Republic of Tanzania | 2002 | 35806497 |
United Republic of Tanzania | 2003 | 36760831 |
United Republic of Tanzania | 2004 | 37765139 |
United Republic of Tanzania | 2005 | 38824384 |
United Republic of Tanzania | 2006 | 39942347 |
United Republic of Tanzania | 2007 | 41119693 |
United Republic of Tanzania | 2008 | 42353790 |
United Republic of Tanzania | 2009 | 43639752 |
United Republic of Tanzania | 2010 | 44973330 |
United Republic of Tanzania | 2011 | 46354607 |
United Republic of Tanzania | 2012 | 47783107 |
United Republic of Tanzania | 2013 | 49253126 |
United States of America | 1995 | 268039654 |
United States of America | 1996 | 271231546 |
United States of America | 1997 | 274606475 |
United States of America | 1998 | 278053607 |
United States of America | 1999 | 281419130 |
United States of America | 2000 | 284594395 |
United States of America | 2001 | 287532638 |
United States of America | 2002 | 290270187 |
United States of America | 2003 | 292883010 |
United States of America | 2004 | 295487267 |
United States of America | 2005 | 298165797 |
United States of America | 2006 | 300942917 |
United States of America | 2007 | 303786752 |
United States of America | 2008 | 306657153 |
United States of America | 2009 | 309491893 |
United States of America | 2010 | 312247116 |
United States of America | 2011 | 314911752 |
United States of America | 2012 | 317505266 |
United States of America | 2013 | 320050716 |
Uruguay | 1995 | 3224383 |
Uruguay | 1996 | 3247585 |
Uruguay | 1997 | 3270549 |
Uruguay | 1998 | 3291677 |
Uruguay | 1999 | 3308884 |
Uruguay | 2000 | 3320841 |
Uruguay | 2001 | 3326762 |
Uruguay | 2002 | 3327500 |
Uruguay | 2003 | 3325411 |
Uruguay | 2004 | 3323822 |
Uruguay | 2005 | 3325155 |
Uruguay | 2006 | 3330217 |
Uruguay | 2007 | 3338384 |
Uruguay | 2008 | 3348898 |
Uruguay | 2009 | 3360431 |
Uruguay | 2010 | 3371982 |
Uruguay | 2011 | 3383486 |
Uruguay | 2012 | 3395253 |
Uruguay | 2013 | 3407062 |
US Virgin Islands | 1995 | 107018 |
US Virgin Islands | 1996 | 107589 |
US Virgin Islands | 1997 | 108002 |
US Virgin Islands | 1998 | 108271 |
US Virgin Islands | 1999 | 108431 |
US Virgin Islands | 2000 | 108511 |
US Virgin Islands | 2001 | 108511 |
US Virgin Islands | 2002 | 108422 |
US Virgin Islands | 2003 | 108259 |
US Virgin Islands | 2004 | 108034 |
US Virgin Islands | 2005 | 107768 |
US Virgin Islands | 2006 | 107458 |
US Virgin Islands | 2007 | 107116 |
US Virgin Islands | 2008 | 106788 |
US Virgin Islands | 2009 | 106530 |
US Virgin Islands | 2010 | 106382 |
US Virgin Islands | 2011 | 106364 |
US Virgin Islands | 2012 | 106462 |
US Virgin Islands | 2013 | 106627 |
Uzbekistan | 1995 | 22950898 |
Uzbekistan | 1996 | 23381250 |
Uzbekistan | 1997 | 23789736 |
Uzbekistan | 1998 | 24170760 |
Uzbekistan | 1999 | 24517962 |
Uzbekistan | 2000 | 24828562 |
Uzbekistan | 2001 | 25098636 |
Uzbekistan | 2002 | 25334021 |
Uzbekistan | 2003 | 25553928 |
Uzbekistan | 2004 | 25784397 |
Uzbekistan | 2005 | 26044401 |
Uzbekistan | 2006 | 26340696 |
Uzbekistan | 2007 | 26668950 |
Uzbekistan | 2008 | 27023200 |
Uzbekistan | 2009 | 27392784 |
Uzbekistan | 2010 | 27769270 |
Uzbekistan | 2011 | 28151746 |
Uzbekistan | 2012 | 28541423 |
Uzbekistan | 2013 | 28934102 |
Vanuatu | 1995 | 168236 |
Vanuatu | 1996 | 171802 |
Vanuatu | 1997 | 175004 |
Vanuatu | 1998 | 178074 |
Vanuatu | 1999 | 181346 |
Vanuatu | 2000 | 185058 |
Vanuatu | 2001 | 189285 |
Vanuatu | 2002 | 193950 |
Vanuatu | 2003 | 198952 |
Vanuatu | 2004 | 204135 |
Vanuatu | 2005 | 209375 |
Vanuatu | 2006 | 214654 |
Vanuatu | 2007 | 220001 |
Vanuatu | 2008 | 225398 |
Vanuatu | 2009 | 230833 |
Vanuatu | 2010 | 236299 |
Vanuatu | 2011 | 241778 |
Vanuatu | 2012 | 247262 |
Vanuatu | 2013 | 252763 |
Venezuela (Bolivarian Republic of) | 1995 | 22092144 |
Venezuela (Bolivarian Republic of) | 1996 | 22556838 |
Venezuela (Bolivarian Republic of) | 1997 | 23020184 |
Venezuela (Bolivarian Republic of) | 1998 | 23482700 |
Venezuela (Bolivarian Republic of) | 1999 | 23945002 |
Venezuela (Bolivarian Republic of) | 2000 | 24407553 |
Venezuela (Bolivarian Republic of) | 2001 | 24870441 |
Venezuela (Bolivarian Republic of) | 2002 | 25333622 |
Venezuela (Bolivarian Republic of) | 2003 | 25797219 |
Venezuela (Bolivarian Republic of) | 2004 | 26261326 |
Venezuela (Bolivarian Republic of) | 2005 | 26725897 |
Venezuela (Bolivarian Republic of) | 2006 | 27190882 |
Venezuela (Bolivarian Republic of) | 2007 | 27655937 |
Venezuela (Bolivarian Republic of) | 2008 | 28120312 |
Venezuela (Bolivarian Republic of) | 2009 | 28583040 |
Venezuela (Bolivarian Republic of) | 2010 | 29043283 |
Venezuela (Bolivarian Republic of) | 2011 | 29500625 |
Venezuela (Bolivarian Republic of) | 2012 | 29954782 |
Venezuela (Bolivarian Republic of) | 2013 | 30405207 |
Viet Nam | 1995 | 76020043 |
Viet Nam | 1996 | 77166873 |
Viet Nam | 1997 | 78199254 |
Viet Nam | 1998 | 79140734 |
Viet Nam | 1999 | 80027521 |
Viet Nam | 2000 | 80887879 |
Viet Nam | 2001 | 81728768 |
Viet Nam | 2002 | 82547682 |
Viet Nam | 2003 | 83352595 |
Viet Nam | 2004 | 84150651 |
Viet Nam | 2005 | 84947852 |
Viet Nam | 2006 | 85747625 |
Viet Nam | 2007 | 86553201 |
Viet Nam | 2008 | 87369203 |
Viet Nam | 2009 | 88199997 |
Viet Nam | 2010 | 89047397 |
Viet Nam | 2011 | 89913956 |
Viet Nam | 2012 | 90795769 |
Viet Nam | 2013 | 91679733 |
Wallis and Futuna Islands | 1995 | 14143 |
Wallis and Futuna Islands | 1996 | 14221 |
Wallis and Futuna Islands | 1997 | 14309 |
Wallis and Futuna Islands | 1998 | 14394 |
Wallis and Futuna Islands | 1999 | 14460 |
Wallis and Futuna Islands | 2000 | 14497 |
Wallis and Futuna Islands | 2001 | 14501 |
Wallis and Futuna Islands | 2002 | 14476 |
Wallis and Futuna Islands | 2003 | 14422 |
Wallis and Futuna Islands | 2004 | 14344 |
Wallis and Futuna Islands | 2005 | 14246 |
Wallis and Futuna Islands | 2006 | 14126 |
Wallis and Futuna Islands | 2007 | 13988 |
Wallis and Futuna Islands | 2008 | 13840 |
Wallis and Futuna Islands | 2009 | 13697 |
Wallis and Futuna Islands | 2010 | 13565 |
Wallis and Futuna Islands | 2011 | 13451 |
Wallis and Futuna Islands | 2012 | 13353 |
Wallis and Futuna Islands | 2013 | 13272 |
West Bank and Gaza Strip | 1995 | 2598393 |
West Bank and Gaza Strip | 1996 | 2722497 |
West Bank and Gaza Strip | 1997 | 2851993 |
West Bank and Gaza Strip | 1998 | 2980563 |
West Bank and Gaza Strip | 1999 | 3099951 |
West Bank and Gaza Strip | 2000 | 3204572 |
West Bank and Gaza Strip | 2001 | 3291620 |
West Bank and Gaza Strip | 2002 | 3363542 |
West Bank and Gaza Strip | 2003 | 3426549 |
West Bank and Gaza Strip | 2004 | 3489743 |
West Bank and Gaza Strip | 2005 | 3559856 |
West Bank and Gaza Strip | 2006 | 3638829 |
West Bank and Gaza Strip | 2007 | 3725076 |
West Bank and Gaza Strip | 2008 | 3817551 |
West Bank and Gaza Strip | 2009 | 3914035 |
West Bank and Gaza Strip | 2010 | 4012880 |
West Bank and Gaza Strip | 2011 | 4114199 |
West Bank and Gaza Strip | 2012 | 4218771 |
West Bank and Gaza Strip | 2013 | 4326295 |
Yemen | 1995 | 15018201 |
Yemen | 1996 | 15578640 |
Yemen | 1997 | 16088019 |
Yemen | 1998 | 16564235 |
Yemen | 1999 | 17035531 |
Yemen | 2000 | 17522537 |
Yemen | 2001 | 18029989 |
Yemen | 2002 | 18551068 |
Yemen | 2003 | 19081306 |
Yemen | 2004 | 19612696 |
Yemen | 2005 | 20139661 |
Yemen | 2006 | 20661714 |
Yemen | 2007 | 21182162 |
Yemen | 2008 | 21703571 |
Yemen | 2009 | 22229625 |
Yemen | 2010 | 22763008 |
Yemen | 2011 | 23304206 |
Yemen | 2012 | 23852409 |
Yemen | 2013 | 24407381 |
Zambia | 1995 | 8841338 |
Zambia | 1996 | 9073311 |
Zambia | 1997 | 9320089 |
Zambia | 1998 | 9577483 |
Zambia | 1999 | 9839179 |
Zambia | 2000 | 10100981 |
Zambia | 2001 | 10362137 |
Zambia | 2002 | 10625423 |
Zambia | 2003 | 10894519 |
Zambia | 2004 | 11174650 |
Zambia | 2005 | 11470022 |
Zambia | 2006 | 11781612 |
Zambia | 2007 | 12109620 |
Zambia | 2008 | 12456527 |
Zambia | 2009 | 12825031 |
Zambia | 2010 | 13216985 |
Zambia | 2011 | 13633796 |
Zambia | 2012 | 14075099 |
Zambia | 2013 | 14538640 |
Zimbabwe | 1995 | 11639364 |
Zimbabwe | 1996 | 11846110 |
Zimbabwe | 1997 | 12045813 |
Zimbabwe | 1998 | 12229500 |
Zimbabwe | 1999 | 12384727 |
Zimbabwe | 2000 | 12503652 |
Zimbabwe | 2001 | 12586763 |
Zimbabwe | 2002 | 12640922 |
Zimbabwe | 2003 | 12673103 |
Zimbabwe | 2004 | 12693047 |
Zimbabwe | 2005 | 12710589 |
Zimbabwe | 2006 | 12724308 |
Zimbabwe | 2007 | 12740160 |
Zimbabwe | 2008 | 12784041 |
Zimbabwe | 2009 | 12888918 |
Zimbabwe | 2010 | 13076978 |
Zimbabwe | 2011 | 13358738 |
Zimbabwe | 2012 | 13724317 |
Zimbabwe | 2013 | 14149648 |
Ok, let’s make a dataset just containing
country == "Ireland"
and make a scatterplot with
year
on the x and population
on the y.
dataset_for_plot <- population %>%
filter(country == "Ireland")
ggplot(data = dataset_for_plot) +
geom_point(mapping = aes(x = year, y = population))
Nice. We can easily make a line plot by swapping
geom_point
for geom_line
in the above.
Let’s make a line plot with the countries France, Germany and Spain each having a different line colour, plotting their populations over time.
dataset_for_plot <- population %>%
filter(country %in% c("France", "Germany", "Spain"))
ggplot(data = dataset_for_plot) +
geom_line(mapping = aes(x = year, y = population, colour = country))
Great. Let’s make a column plot using geom_col
. We’ll
filter a couple of countries and take the data just from 2010.
dataset_for_plot <- population %>%
filter(country %in% c("France", "Germany", "Spain", "Italy", "Poland"), year == 2010)
ggplot(data = dataset_for_plot) +
geom_col(mapping = aes(x = country, y = population))
We can turn this into a bar plot easily by adding
coord_flip()
:
ggplot(data = dataset_for_plot) +
geom_col(mapping = aes(x = country, y = population)) +
coord_flip()
Let’s return to our line plot for France, Germany and Spain. If we
wanted lines and points it would make more sense to put the
aes
mapping function within the ggplot
rather
than in both the geom_line
and geom_point
:
dataset_for_plot <- population %>%
filter(country %in% c("France", "Germany", "Spain"))
ggplot(data = dataset_for_plot , mapping = aes(x = year, y = population, colour = country)) +
geom_line() +
geom_point()
Let’s do the same plot, but change some of the labels. We’ll change
the y-axis label to “Persons”, leave both the x-axis title and legend
title blank, and set the heading to “Population of selected countries
over time”. All of that can be done through the labs
function.
ggplot(data = dataset_for_plot , mapping = aes(x = year, y = population, colour = country)) +
geom_line() +
geom_point() +
labs(x = "",
y = "Persons",
colour = "",
title = "Population of selected countries over time")
Let’s do the same plot (we’ll forget about the labels) but make two
adjustments to the y-axis. We will use the function
scale_y_continuous
which has lots of tools within it for
tailoring a continuous y-axis.
The function scale_y_continuous
is one of a large family
of functions with the format scale_DIM_FORMAT
where DIM is
the dimension (x, y, fill, colour, etc.) and FORMAT is the type of axis.
See the second page of the ggplot2 cheatsheet for more information.
We’ll change the limits of the y-axis so that it starts at zero. This
is done using the limits
argument to
scale_y_continuous
, and limits
takes a vector
of length two, the first entry being the lower limit and the second
entry being the upper limit. I’ll set the lower limit to zero, but I’ll
leave the upper limit as NA
, meaning that I’ll leave it up
to the data to determine how high the y-axis should go.
I’ll change the labels on the y so that they show the whole number
with comma separators rather than the scientific format which has
appeared. That is done with the labels
argument to
scale_y_continuous
. I’m setting that argument as being
equal to comma
, which is actually a function from the
package scales. This package provide a bunch of tools that make it
easier to tailor axes and legends. The scales package is installed with
tidyverse but needs to be loaded in using library(scales)
.
If the y-axis needed to be formatted as a percentage, then you’d replace
comma
with percent
(percent
is
another function from scales).
library(scales)
ggplot(data = dataset_for_plot , mapping = aes(x = year, y = population, colour = country)) +
geom_line() +
geom_point() +
scale_y_continuous(limits = c(0,NA) , label = comma )
There are tons of other ways to edit the appearance of plots through
ggplot, but these would be beyond a crash course. I’ll wrap up with one
tool for altering the appearance which is to add a theme. There are 8
themes including the default theme_grey()
. There is
theme_light()
, theme_dark()
,
theme_bw()
. My favourite is theme_minimal()
.
Use the help (?theme_grey
) to find out more.
library(scales)
ggplot(data = dataset_for_plot , mapping = aes(x = year, y = population, colour = country)) +
geom_line() +
geom_point() +
scale_y_continuous(limits = c(0,NA) , label = comma ) +
theme_minimal()