607-week10-assignment.R

[For your convenience], here is provided code based in Jared Lander’s R for Everyone,

if (!require(XML)) install.packages('XML')
## Loading required package: XML
## Warning: package 'XML' was built under R version 3.1.3
if (!require(dplyr)) install.packages('dplyr')
## Loading required package: dplyr
## Warning: package 'dplyr' was built under R version 3.1.3
## 
## Attaching package: 'dplyr'
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
if (!require(rvest)) install.packages("rvest")
## Loading required package: rvest
## Warning: package 'rvest' was built under R version 3.1.3
## 
## Attaching package: 'rvest'
## 
## The following object is masked from 'package:XML':
## 
##     xml
if (!require(tidyr)) install.packages('tidyr')
## Loading required package: tidyr
## Warning: package 'tidyr' was built under R version 3.1.3
if (!require(RCurl)) install.packages('RCurl')
## Loading required package: RCurl
## Warning: package 'RCurl' was built under R version 3.1.3
## Loading required package: bitops
library(XML)
library(dplyr)
library(rvest)
library(tidyr)
library(RCurl)

You can also embed plots, for example:

theURL <- "http://www.jaredlander.com/2012/02/another-kind-of-super-bowl-pool/"
bowlPool <- readHTMLTable(theURL, which = 1, header = FALSE, stringsAsFactors = FALSE)
bowlPool[[1]]
##  [1] "Participant 1"  "Participant 2"  "Participant 3"  "Participant 4" 
##  [5] "Participant 5"  "Participant 6"  "Participant 7"  "Participant 8" 
##  [9] "Participant 9"  "Participant 10"
# 1. What type of data structure is bowlpool? 
# it is data frame.
class(bowlPool)
## [1] "data.frame"
# Or using str() also provides the type and additional information
str(bowlPool)
## 'data.frame':    10 obs. of  3 variables:
##  $ V1: chr  "Participant 1" "Participant 2" "Participant 3" "Participant 4" ...
##  $ V2: chr  "Giant A" "Giant B" "Giant C" "Giant D" ...
##  $ V3: chr  "Patriot Q" "Patriot R" "Patriot S" "Patriot T" ...
length(bowlPool)
## [1] 3
bowlPool[[1]]
##  [1] "Participant 1"  "Participant 2"  "Participant 3"  "Participant 4" 
##  [5] "Participant 5"  "Participant 6"  "Participant 7"  "Participant 8" 
##  [9] "Participant 9"  "Participant 10"
bowlPool[[2]]
##  [1] "Giant A" "Giant B" "Giant C" "Giant D" "Giant E" "Giant F" "Giant G"
##  [8] "Giant H" "Giant I" "Giant J"
bowlPool[[3]]
##  [1] "Patriot Q" "Patriot R" "Patriot S" "Patriot T" "Patriot U"
##  [6] "Patriot V" "Patriot W" "Patriot X" "Patriot Y" "Patriot Z"
# 2. Suppose instead you call readHTMLTable() with just the URL argument,
# against the provided URL, as shown below

theURL <- "http://www.w3schools.com/html/html_tables.asp"
hvalues <- readHTMLTable(theURL)

# What is the type of variable returned in hvalues?
# the hvalues is of type list

str(hvalues)
## List of 6
##  $ NULL:'data.frame':    4 obs. of  4 variables:
##   ..$ Number    : Factor w/ 4 levels "1","2","3","4": 1 2 3 4
##   ..$ First Name: Factor w/ 4 levels "Adam","Eve","Jill",..: 2 4 1 3
##   ..$ Last Name : Factor w/ 4 levels "Doe","Jackson",..: 2 1 3 4
##   ..$ Points    : Factor w/ 4 levels "50","67","80",..: 4 3 2 1
##  $ NULL: NULL
##  $ NULL: NULL
##  $ NULL: NULL
##  $ NULL: NULL
##  $ NULL:'data.frame':    10 obs. of  2 variables:
##   ..$ Tag        : Factor w/ 10 levels "<caption>","<col>",..: 4 8 10 6 1 3 2 9 5 7
##   ..$ Description: Factor w/ 10 levels "Defines a cell in a table",..: 4 2 3 1 5 9 10 8 6 7
class(hvalues)
## [1] "list"

3. Write R code that shows how many HTML tables are represented in hvalues

Created function called table_count that that traverse hvalues and count tables/frames and

disregarding NULL data structures. total number on not NULL tables is 2.

table_count <- function(x) {

N= length(x)
count01=0
j=0
i=1
tbl_count=0

for (i in 1:N ) { if (class(x[[i]]) == "NULL")  j=j+1 
                  else  i<- i+1   }

tbl_count <- i-1-j

return(tbl_count)
}

The function above the number of not null tables is 2

table_count(hvalues)
## [1] 2
# Validating the resultins..  from below, only hvalues[[1]] and hvalues[[6]] return valid tables


hvalues[[1]]
##   Number First Name Last Name Points
## 1      1        Eve   Jackson     94
## 2      2       John       Doe     80
## 3      3       Adam   Johnson     67
## 4      4       Jill     Smith     50
hvalues[[2]]
## NULL
hvalues[[3]]
## NULL
hvalues[[4]]
## NULL
hvalues[[5]]
## NULL
hvalues[[6]]
##           Tag
## 1     <table>
## 2        <th>
## 3        <tr>
## 4        <td>
## 5   <caption>
## 6  <colgroup>
## 7       <col>
## 8     <thead>
## 9     <tbody>
## 10    <tfoot>
##                                                                Description
## 1                                                          Defines a table
## 2                                         Defines a header cell in a table
## 3                                                 Defines a row in a table
## 4                                                Defines a cell in a table
## 5                                                  Defines a table caption
## 6       Specifies a group of one or more columns in a table for formatting
## 7  Specifies column properties for each column within a <colgroup> element
## 8                                     Groups the header content in a table
## 9                                       Groups the body content in a table
## 10                                    Groups the footer content in a table

4. Modify the readHTMLTable code so that just the table with Number,

FirstName, LastName, # and Points is returned into a dataframe

doc <-  htmlParse(theURL)
tableNodes <- getNodeSet(doc, "//table")
tb <- readHTMLTable(tableNodes[[1]])
tb
##   Number First Name Last Name Points
## 1      1        Eve   Jackson     94
## 2      2       John       Doe     80
## 3      3       Adam   Johnson     67
## 4      4       Jill     Smith     50
# Or if you know which table has FirstName, LastName, # and Points, just do the below  

df_tbl<- data.frame(hvalues[[1]])
df_tbl
##   Number First.Name Last.Name Points
## 1      1        Eve   Jackson     94
## 2      2       John       Doe     80
## 3      3       Adam   Johnson     67
## 4      4       Jill     Smith     50
# 5. Modify the returned data frame so only the Last Name and Points columns are shown.

# Using select in dplyr package 
select(df_tbl, 3, 4)
##   Last.Name Points
## 1   Jackson     94
## 2       Doe     80
## 3   Johnson     67
## 4     Smith     50

6 Identify another interesting page on the web with HTML table values.

This may be somewhat tricky, because while

HTML tables are great for web-page scrapers, many HTML designers now prefer

# creating tables using other methods (such as

tags or .png files).

url <-  "http://en.wikipedia.org/wiki/List_of_countries_by_population"
html_tables = readHTMLTable(url, table_counter=TRUE)
# 7 How many HTML tables does that page contain?

# using the table_count function above, there are 4 tables. 
length(html_tables)
## [1] 5
table_count(html_tables)
## [1] 4
# validating the results. only html_tables[[3]] has value of NULL.  

html_tables[[1]]
##     Rank                  Country (or dependent territory)    Population
## 1      1                                     China[Note 2] 1,369,040,000
## 2      2                                             India 1,269,090,000
## 3      3                                     United States   320,704,000
## 4      4                                         Indonesia   255,461,700
## 5      5                                            Brazil   204,100,000
## 6      6                                          Pakistan   189,388,000
## 7      7                                           Nigeria   183,523,000
## 8      8                                        Bangladesh   158,088,000
## 9      9                                    Russia[Note 3]   146,267,288
## 10    10                                             Japan   126,910,000
## 11    11                                            Mexico   121,005,815
## 12    12                                       Philippines   101,227,000
## 13    13                                           Vietnam    90,730,000
## 14    14                                          Ethiopia    90,076,012
## 15    15                                             Egypt    88,269,400
## 16    16                                           Germany    80,925,000
## 17    17                                              Iran    78,229,000
## 18    18                                            Turkey    77,695,904
## 19    19                  Democratic Republic of the Congo    71,246,000
## 20    20                                    France[Note 4]    66,109,000
## 21    21                                          Thailand    64,871,000
## 22    22                                    United Kingdom    64,105,654
## 23    23                                             Italy    60,788,845
## 24    24                                      South Africa    54,002,000
## 25    25                                             Burma    51,419,420
## 26    26                                       South Korea    51,342,881
## 27    27                                          Colombia    48,063,200
## 28    28                                          Tanzania    47,421,786
## 29    29                                             Kenya    46,749,000
## 30    30                                             Spain    46,464,053
## 31    31                                         Argentina    43,131,966
## 32    32                                   Ukraine[Note 5]    42,928,900
## 33    33                                           Algeria    39,500,000
## 34    34                                            Poland    38,484,000
## 35    35                                             Sudan    38,435,252
## 36    36                                              Iraq    36,004,552
## 37    37                                            Canada    35,702,707
## 38    38                                            Uganda    34,856,813
## 39    39                                        Morocco[7]    33,337,529
## 40    40                                      Saudi Arabia    31,521,418
## 41    41                                              Peru    31,151,643
## 42    42                                         Venezuela    30,620,404
## 43    43                                          Malaysia    30,538,100
## 44    44                                        Uzbekistan    30,492,800
## 45    45                                             Nepal    28,037,904
## 46    46                                             Ghana    27,043,093
## 47    47                                       Afghanistan    26,556,800
## 48    48                                             Yemen    25,956,000
## 49    49                                        Mozambique    25,727,911
## 50    50                                       North Korea    25,155,000
## 51    51                                            Angola    24,383,301
## 52    52                                         Australia    23,795,300
## 53    53                                    Taiwan[Note 6]    23,445,534
## 54    54                                             Syria    23,126,857
## 55    55                                       Ivory Coast    22,671,331
## 56    56                                        Madagascar    21,842,167
## 57    57                                          Cameroon    21,143,237
## 58    58                                         Sri Lanka    20,675,000
## 59    59                                           Romania    19,942,642
## 60    60                                             Niger    19,268,000
## 61    61                                      Burkina Faso    18,450,494
## 62    62                                             Chile    18,006,407
## 63    63                                        Kazakhstan    17,439,300
## 64    64                                       Netherlands    16,896,200
## 65    65                                            Malawi    16,310,431
## 66    66                                              Mali    16,259,000
## 67    67                                           Ecuador    15,963,300
## 68    68                                         Guatemala    15,806,675
## 69    69                                            Zambia    15,473,905
## 70    70                                          Cambodia    15,405,157
## 71    71                                              Chad    13,606,000
## 72    72                                           Senegal    13,508,715
## 73    73                                          Zimbabwe    13,061,239
## 74    74                                       South Sudan    11,892,934
## 75    75                                           Bolivia    11,410,651
## 76    76                                           Belgium    11,239,755
## 77    77                                              Cuba    11,210,064
## 78    78                                   Somalia[Note 8]    11,123,000
## 79    79                                            Rwanda    10,996,891
## 80    80                                            Greece    10,992,589
## 81    81                                           Tunisia    10,982,754
## 82    82                                             Haiti    10,911,819
## 83    83                                            Guinea    10,628,972
## 84    84                                    Czech Republic    10,528,477
## 85    85                                          Portugal    10,477,800
## 86    86                                Dominican Republic    10,378,267
## 87    87                                             Benin    10,315,244
## 88    88                                           Hungary     9,849,000
## 89    89                                           Burundi     9,823,827
## 90    90                                            Sweden     9,753,627
## 91    91                                        Azerbaijan     9,593,000
## 92    92                              United Arab Emirates     9,577,000
## 93    93                                           Belarus     9,481,000
## 94    94                                          Honduras     8,725,111
## 95    95                                           Austria     8,579,747
## 96    96                                        Tajikistan     8,354,000
## 97    97                                            Israel     8,320,100
## 98    98                                       Switzerland     8,211,700
## 99    99                                  Papua New Guinea     7,398,500
## 100  100                                 Hong Kong (China)     7,264,100
## 101  101                                          Bulgaria     7,245,677
## 102  102                                              Togo     7,171,000
## 103  103                                    Serbia[Note 9]     7,146,759
## 104  104                                          Paraguay     7,003,406
## 105  105                                              Laos     6,802,000
## 106  106                                           Eritrea     6,738,000
## 107  107                                            Jordan     6,708,370
## 108  108                                       El Salvador     6,401,240
## 109  109                                      Sierra Leone     6,319,000
## 110  110                                             Libya     6,317,000
## 111  111                                         Nicaragua     6,134,270
## 112  112                                        Kyrgyzstan     5,895,100
## 113  113                                           Denmark     5,659,715
## 114  114                                           Finland     5,475,526
## 115  115                                         Singapore     5,469,700
## 116  116                                          Slovakia     5,421,034
## 117  117                                            Norway     5,165,802
## 118  118                          Central African Republic     4,803,000
## 119  119                                        Costa Rica     4,773,130
## 120  120                                      Turkmenistan     4,751,120
## 121  121                             Republic of the Congo     4,671,000
## 122  122                                           Ireland     4,609,600
## 123  123                                       New Zealand     4,572,100
## 124  124                                         Palestine     4,550,368
## 125  125                                           Liberia     4,503,000
## 126  126                                  Georgia[Note 10]     4,490,500
## 127  127                                           Croatia     4,267,558
## 128  128                                              Oman     4,146,558
## 129  129                                           Lebanon     4,104,000
## 130  130                            Bosnia and Herzegovina     3,791,622
## 131  131                                            Panama     3,764,166
## 132  132                                        Mauritania     3,631,775
## 133  133                                  Moldova[Note 11]     3,557,600
## 134  134                                Puerto Rico (U.S.)     3,548,397
## 135  135                                           Uruguay     3,404,189
## 136  136                                            Kuwait     3,268,431
## 137  137                                           Armenia     3,013,900
## 138  138                                          Mongolia     3,000,000
## 139  139                                         Lithuania     2,919,306
## 140  140                                           Albania     2,893,005
## 141  141                                           Jamaica     2,717,991
## 142  142                                             Qatar     2,334,029
## 143  143                                           Lesotho     2,120,000
## 144  144                                           Namibia     2,113,077
## 145  145                                         Macedonia     2,065,769
## 146  146                                          Slovenia     2,066,143
## 147  147                                          Botswana     2,024,904
## 148  148                                            Latvia     1,986,700
## 149  149                                        The Gambia     1,882,450
## 150  150                                   Kosovo[Note 12]     1,827,231
## 151  151                                     Guinea-Bissau     1,788,000
## 152  152                                             Gabon     1,751,000
## 153  153                                 Equatorial Guinea     1,430,000
## 154  154                               Trinidad and Tobago     1,328,019
## 155  155                                           Bahrain     1,316,500
## 156  156                                           Estonia     1,312,252
## 157  157                                         Mauritius     1,261,208
## 158  158                                        East Timor     1,212,107
## 159  159                                         Swaziland     1,119,375
## 160  160                                          Djibouti       900,000
## 161  161                                              Fiji       859,178
## 162  162                                   Cyprus[Note 13]       858,000
## 163  163                                  Réunion (France)       844,994
## 164  164                                           Comoros       763,952
## 165  165                                            Bhutan       758,880
## 166  166                                            Guyana       746,900
## 167  167                                     Macau (China)       636,200
## 168  168                                        Montenegro       620,029
## 169  169                                   Solomon Islands       581,344
## 170  170                                        Luxembourg       549,700
## 171  171                                          Suriname       534,189
## 172  172                                        Cape Verde       518,467
## 173  173                           Western Sahara[Note 14]       510,713
## 174  174                             Transnistria[Note 15]       505,153
## 175  175                                             Malta       425,384
## 176  176                               Guadeloupe (France)       405,739
## 177  177                                            Brunei       393,372
## 178  178                               Martinique (France)       381,326
## 179  179                                       The Bahamas       368,390
## 180  180                                            Belize       358,899
## 181  181                                          Maldives       341,256
## 182  182                                           Iceland       329,100
## 183  183                          Northern Cyprus[Note 16]       294,906
## 184  184                                          Barbados       285,000
## 185  185                            New Caledonia (France)       268,767
## 186  186                         French Polynesia (France)       268,270
## 187  187                                           Vanuatu       264,652
## 188  188                                 Abkhazia[Note 17]       240,705
## 189  189                            French Guiana (France)       239,648
## 190  190                                  Mayotte (France)       212,645
## 191  191                                             Samoa       187,820
## 192  192                             São Tomé and Príncipe       187,356
## 193  193                                       Saint Lucia       185,000
## 194  194                                       Guam (U.S.)       159,358
## 195  195                             Curaçao (Netherlands)       154,843
## 196  196                  Saint Vincent and the Grenadines       109,000
## 197  197                               Aruba (Netherlands)       107,394
## 198  198                                          Kiribati       106,461
## 199  199               United States Virgin Islands (U.S.)       106,405
## 200  200                                           Grenada       103,328
## 201  201                                             Tonga       103,252
## 202  202                    Federated States of Micronesia       101,351
## 203  203                                       Jersey (UK)        99,000
## 204  204                                        Seychelles        89,949
## 205  205                               Antigua and Barbuda        86,295
## 206  206                                  Isle of Man (UK)        84,497
## 207  207                                           Andorra        76,949
## 208  208                                          Dominica        71,293
## 209  209                                      Bermuda (UK)        64,237
## 210  210                                     Guernsey (UK)        63,085
## 211  211                                  Marshall Islands        56,086
## 212  212                               Greenland (Denmark)        55,984
## 213  213                               Cayman Islands (UK)        55,691
## 214  214                             American Samoa (U.S.)        55,519
## 215  215                             Saint Kitts and Nevis        55,000
## 216  216                   Northern Mariana Islands (U.S.)        53,883
## 217  217                            South Ossetia[Note 18]        51,547
## 218  218                           Faroe Islands (Denmark)        48,724
## 219  219                        Sint Maarten (Netherlands)        37,429
## 220  220                                     Liechtenstein        37,370
## 221  221                                            Monaco        36,950
## 222  222             Collectivity of Saint Martin (France)        35,742
## 223  223                                        San Marino        32,789
## 224  224                     Turks and Caicos Islands (UK)        31,458
## 225  225                                    Gibraltar (UK)        30,001
## 226  226                           Åland Islands (Finland)        28,875
## 227  227                       British Virgin Islands (UK)        28,054
## 228  228               Caribbean Netherlands (Netherlands)        23,296
## 229  229                                             Palau        20,901
## 230  230                        Cook Islands (New Zealand)        14,974
## 231  231                                     Anguilla (UK)        13,452
## 232  232                        Wallis and Futuna (France)        13,135
## 233  233                                            Tuvalu        11,323
## 234  234                                             Nauru        10,084
## 235  235                         Saint Barthélemy (France)         9,131
## 236  236                Saint Pierre and Miquelon (France)         6,069
## 237  237                                   Montserrat (UK)         4,922
## 238  238 Saint Helena, Ascension and Tristan da Cunha (UK)         4,000
## 239  239                             Falkland Islands (UK)         3,000
## 240  240                   Svalbard and Jan Mayen (Norway)         2,562
## 241  241                        Norfolk Island (Australia)         2,302
## 242  242                      Christmas Island (Australia)         2,072
## 243  243                                Niue (New Zealand)         1,613
## 244  244                                      Tokelau (NZ)         1,411
## 245  245                                      Vatican City           839
## 246  246               Cocos (Keeling) Islands (Australia)           550
## 247  247                             Pitcairn Islands (UK)            56
##                   Date % of world\npopulation
## 1        April 1, 2015                  18.9%
## 2        April 1, 2015                  17.5%
## 3        April 1, 2015                  4.43%
## 4         July 1, 2015                  3.53%
## 5        April 1, 2015                  2.82%
## 6        April 1, 2015                  2.62%
## 7         July 1, 2015                  2.54%
## 8        April 1, 2015                  2.19%
## 9      January 1, 2015                  2.02%
## 10       March 1, 2015                  1.75%
## 11        July 1, 2015                  1.67%
## 12       April 1, 2015                   1.4%
## 13        July 1, 2014                  1.25%
## 14        July 1, 2015                  1.25%
## 15       April 1, 2015                  1.22%
## 16       June 30, 2014                  1.12%
## 17       April 1, 2015                  1.08%
## 18   December 31, 2014                  1.07%
## 19        July 1, 2015                  0.98%
## 20       March 1, 2015                  0.91%
## 21        July 1, 2014                   0.9%
## 22        July 1, 2013                  0.89%
## 23   November 30, 2014                  0.84%
## 24        July 1, 2014                  0.75%
## 25      March 29, 2014                  0.71%
## 26     January 1, 2015                  0.71%
## 27       April 1, 2015                 0.664%
## 28        July 1, 2014                  0.66%
## 29        July 1, 2015                  0.65%
## 30        July 1, 2014                  0.64%
## 31        July 1, 2015                   0.6%
## 32     January 1, 2015                  0.59%
## 33     January 1, 2015                  0.55%
## 34   December 31, 2014                  0.53%
## 35        July 1, 2015                  0.53%
## 36        July 1, 2014                   0.5%
## 37     January 1, 2015                  0.49%
## 38     August 28, 2014                  0.48%
## 39   September 1, 2014                  0.46%
## 40        July 1, 2015                  0.44%
## 41        July 1, 2015                  0.43%
## 42        July 1, 2015                  0.42%
## 43       April 1, 2015                 0.422%
## 44     January 1, 2014                  0.42%
## 45        July 1, 2015                  0.39%
## 46        July 1, 2014                  0.37%
## 47        July 1, 2014                  0.37%
## 48        July 1, 2014                  0.36%
## 49        July 1, 2015                  0.36%
## 50        July 1, 2015                  0.35%
## 51        May 16, 2014                  0.34%
## 52       April 1, 2015                 0.329%
## 53   February 28, 2015                  0.32%
## 54       April 1, 2015                  0.32%
## 55        May 15, 2014                  0.31%
## 56        July 1, 2013                   0.3%
## 57        July 1, 2013                  0.28%
## 58        July 1, 2014                  0.28%
## 59     January 1, 2014                  0.28%
## 60        July 1, 2015                  0.27%
## 61        July 1, 2015                  0.26%
## 62        July 1, 2015                  0.25%
## 63    February 1, 2015                  0.24%
## 64       April 1, 2015                 0.234%
## 65        July 1, 2015                  0.23%
## 66        July 1, 2015                  0.22%
## 67       April 1, 2015                  0.22%
## 68        July 1, 2014                  0.22%
## 69        July 1, 2015                  0.21%
## 70        July 1, 2015                  0.21%
## 71        July 1, 2015                  0.19%
## 72   November 19, 2013                  0.19%
## 73     August 17, 2012                  0.18%
## 74        July 1, 2015                  0.16%
## 75        July 1, 2015                  0.16%
## 76    February 1, 2015                  0.16%
## 77   December 31, 2013                  0.15%
## 78        July 1, 2015                  0.15%
## 79        July 1, 2014                  0.15%
## 80     January 1, 2014                  0.15%
## 81      April 23, 2014                  0.15%
## 82        July 1, 2015                  0.15%
## 83       April 2, 2014                  0.15%
## 84  September 30, 2014                  0.15%
## 85   December 31, 2013                  0.14%
## 86        July 1, 2014                  0.14%
## 87        July 1, 2015                  0.14%
## 88   December 31, 2014                  0.14%
## 89        July 1, 2015                  0.14%
## 90    January 31, 2015                  0.13%
## 91     January 1, 2015                  0.13%
## 92        July 1, 2015                  0.13%
## 93     January 1, 2015                  0.13%
## 94        July 1, 2014                  0.12%
## 95     January 1, 2015                  0.12%
## 96     January 1, 2015                  0.12%
## 97   February 28, 2015                  0.12%
## 98  September 30, 2014                  0.11%
## 99        July 1, 2013                 0.102%
## 100  December 31, 2014                   0.1%
## 101  December 31, 2013                   0.1%
## 102       July 1, 2015                 0.099%
## 103    January 1, 2014                 0.099%
## 104               2015                 0.097%
## 105       July 1, 2015                 0.094%
## 106       July 1, 2015                 0.093%
## 107      April 1, 2015                0.0927%
## 108               2014                 0.088%
## 109       July 1, 2015                 0.087%
## 110       July 1, 2015                 0.087%
## 111               2013                 0.085%
## 112    January 1, 2015                 0.081%
## 113    January 1, 2015                 0.078%
## 114   February 1, 2015                 0.076%
## 115       July 1, 2014                 0.076%
## 116 September 30, 2014                 0.075%
## 117    January 1, 2015                 0.071%
## 118       July 1, 2015                 0.066%
## 119      June 30, 2014                 0.066%
## 120  December 26, 2012                 0.066%
## 121       July 1, 2015                 0.065%
## 122      April 1, 2014                 0.064%
## 123      April 1, 2015                0.0632%
## 124       July 1, 2014                 0.063%
## 125       July 1, 2015                 0.062%
## 126    January 1, 2014                 0.062%
## 127       July 1, 2012                 0.059%
## 128     March 18, 2015                 0.057%
## 129       July 1, 2012                 0.057%
## 130   October 15, 2013                 0.052%
## 131       July 1, 2015                  0.05%
## 132       July 1, 2015                  0.05%
## 133    January 1, 2014                 0.049%
## 134       July 1, 2014                 0.049%
## 135      June 30, 2014                 0.047%
## 136       July 1, 2012                 0.045%
## 137 September 30, 2014                 0.042%
## 138   January 24, 2015                 0.041%
## 139   February 1, 2014                  0.04%
## 140    January 1, 2015                  0.04%
## 141  December 31, 2013                 0.038%
## 142  February 28, 2015                 0.032%
## 143       July 1, 2015                 0.029%
## 144    August 28, 2011                 0.029%
## 145  December 31, 2013                 0.029%
## 146      April 1, 2015                 0.029%
## 147    August 22, 2011                 0.028%
## 148   February 1, 2015                 0.027%
## 149     April 15, 2013                 0.026%
## 150               2015                 0.025%
## 151       July 1, 2015                 0.025%
## 152       July 1, 2015                 0.024%
## 153       July 1, 2013                  0.02%
## 154    January 9, 2011                 0.018%
## 155       July 1, 2014                 0.018%
## 156    January 1, 2015                 0.018%
## 157       July 1, 2014                 0.017%
## 158       July 1, 2014                 0.017%
## 159       July 1, 2015                 0.015%
## 160       July 1, 2015                 0.012%
## 161       July 1, 2013                0.0119%
## 162    January 1, 2014                 0.012%
## 163    January 1, 2014                 0.012%
## 164       July 1, 2014                 0.011%
## 165      April 1, 2015                0.0105%
## 166       July 1, 2013                  0.01%
## 167  December 31, 2014                0.0088%
## 168      April 1, 2011                0.0086%
## 169       July 1, 2013                 0.008%
## 170  December 31, 2013                0.0074%
## 171    August 13, 2012                0.0074%
## 172       July 1, 2014                0.0072%
## 173  September 2, 2014                0.0071%
## 174    January 1, 2014                 0.007%
## 175  December 31, 2013                0.0059%
## 176    January 1, 2013                0.0056%
## 177      June 20, 2011                0.0054%
## 178    January 1, 2014                0.0053%
## 179       July 1, 2013                0.0051%
## 180       July 1, 2014                 0.005%
## 181 September 20, 2014                0.0047%
## 182    January 1, 2015                0.0045%
## 183     April 30, 2006                 0.004%
## 184       July 1, 2013                0.0039%
## 185    August 26, 2014                0.0037%
## 186    August 22, 2012                0.0037%
## 187       July 1, 2013                0.0037%
## 188               2011                0.0033%
## 189    January 1, 2012                0.0033%
## 190    August 21, 2012                0.0029%
## 191   November 7, 2011                0.0026%
## 192       May 13, 2012                0.0026%
## 193       July 1, 2015                0.0026%
## 194      April 1, 2010                0.0022%
## 195    January 1, 2014                0.0021%
## 196       July 1, 2015                0.0015%
## 197   October 31, 2014                0.0015%
## 198       July 1, 2013                0.0015%
## 199      April 1, 2010                0.0015%
## 200       May 12, 2011                0.0014%
## 201  November 30, 2011                0.0014%
## 202       July 1, 2013                0.0014%
## 203  December 31, 2012                0.0014%
## 204       July 1, 2013                0.0012%
## 205       May 27, 2011                0.0012%
## 206     March 27, 2011                0.0012%
## 207       July 1, 2014                0.0011%
## 208       May 14, 2011               0.00099%
## 209       May 20, 2010               0.00089%
## 210     March 31, 2012               0.00087%
## 211       July 1, 2013               0.00078%
## 212    January 1, 2015               0.00077%
## 213               2013               0.00077%
## 214      April 1, 2010               0.00077%
## 215       July 1, 2015               0.00076%
## 216      April 1, 2010               0.00074%
## 217      January, 2013               0.00071%
## 218    January 1, 2015               0.00067%
## 219    January 1, 2010               0.00052%
## 220  December 31, 2014               0.00052%
## 221  December 31, 2013               0.00051%
## 222    January 1, 2012               0.00049%
## 223  December 31, 2014               0.00045%
## 224   January 25, 2012               0.00043%
## 225  December 31, 2012               0.00041%
## 226 September 30, 2014                0.0004%
## 227      July 12, 2010               0.00039%
## 228    January 1, 2013               0.00032%
## 229       July 1, 2013               0.00029%
## 230   December 1, 2011               0.00021%
## 231       May 11, 2011               0.00019%
## 232       July 1, 2013               0.00018%
## 233       July 1, 2013               0.00016%
## 234   October 30, 2011               0.00014%
## 235    January 1, 2012               0.00013%
## 236    January 1, 2012              0.000084%
## 237       May 12, 2011              0.000068%
## 238       July 1, 2015              0.000055%
## 239       July 1, 2015              0.000041%
## 240       July 1, 2014              0.000037%
## 241     August 9, 2011              0.000032%
## 242     August 9, 2011              0.000029%
## 243 September 10, 2011              0.000022%
## 244   October 18, 2011              0.000020%
## 245       July 1, 2012              0.000012%
## 246     August 9, 2011             0.0000076%
## 247               2013            0.00000077%
##                                Source
## 1           Official population clock
## 2                    Population clock
## 3           Official population clock
## 4                   Official estimate
## 5           Official population clock
## 6           Official population clock
## 7                    UN projection[6]
## 8           Official population clock
## 9                   Official estimate
## 10          Monthly official estimate
## 11                Official projection
## 12          Official population clock
## 13           Annual official estimate
## 14                Official projection
## 15          Official population clock
## 16                  Official estimate
## 17          Official population clock
## 18           Annual official estimate
## 19                      UN projection
## 20          Monthly official estimate
## 21         Official annual projection
## 22           Annual official estimate
## 23          Monthly official estimate
## 24                  Official estimate
## 25     Preliminary 2014 census result
## 26                Official projection
## 27          Official population clock
## 28                Official Projection
## 29                      UN projection
## 30                  Official estimate
## 31         Official annual projection
## 32          Monthly official estimate
## 33                  Official estimate
## 34                  Official estimate
## 35         Official annual projection
## 36         Official annual projection
## 37                  Official estimate
## 38     Preliminary 2014 census result
## 39     Preliminary 2014 census result
## 40         Official annual projection
## 41         Official annual projection
## 42         Official annual projection
## 43          Official population clock
## 44                  Official estimate
## 45         Official annual projection
## 46         Official annual projection
## 47                  Official estimate
## 48                  Official estimate
## 49         Annual official projection
## 50                      UN projection
## 51     Preliminary 2014 census result
## 52          Official population clock
## 53          Monthly official estimate
## 54  Official population clock[Note 7]
## 55     Preliminary 2014 Census Result
## 56           Annual official estimate
## 57                  Official estimate
## 58                  Official Estimate
## 59           Annual official estimate
## 60                      UN projection
## 61                  Official estimate
## 62         Official annual projection
## 63          Monthly official estimate
## 64          Official population clock
## 65         Official annual projection
## 66                      UN projection
## 67          Official population clock
## 68                  Official estimate
## 69         Official annual projection
## 70         Official annual projection
## 71                      UN projection
## 72                 2013 census result
## 73                 2012 Census Result
## 74         Official annual projection
## 75                Official projection
## 76          Monthly official estimate
## 77           Annual official estimate
## 78                      UN projection
## 79           Annual official estimate
## 80                  Official estimate
## 81     Preliminary 2014 census result
## 82                Official projection
## 83     Preliminary 2014 census result
## 84        Official quarterly estimate
## 85           Annual official estimate
## 86                  Official estimate
## 87                Official projection
## 88           Annual official estimate
## 89         Official annual projection
## 90          Monthly official estimate
## 91                  Official estimate
## 92                      UN projection
## 93        Quarterly official estimate
## 94           Annual official estimate
## 95       Quarterly provisional figure
## 96                  Official estimate
## 97          Official monthly estimate
## 98       Quarterly provisional figure
## 99           Annual official estimate
## 100                 Official estimate
## 101                 Official estimate
## 102                     UN projection
## 103          Annual official estimate
## 104                 Official estimate
## 105        Annual official projection
## 106                     UN projection
## 107         Official population clock
## 108                 Official estimate
## 109                     UN projection
## 110                     UN projection
## 111                 Official estimate
## 112                 Official estimate
## 113       Quarterly official estimate
## 114         Official population clock
## 115                 Official estimate
## 116                 Official estimate
## 117       Quarterly official estimate
## 118                     UN projection
## 119                 Official estimate
## 120    Preliminary 2012 census result
## 121                     UN projection
## 122          Annual official estimate
## 123         Official population clock
## 124                 Official estimate
## 125                     UN projection
## 126          Annual official estimate
## 127          Annual official estimate
## 128          Weekly official estimate
## 129                 Official estimate
## 130    Preliminary 2013 census result
## 131                 Official estimate
## 132          Annual official estimate
## 133                 Official estimate
## 134                 Official estimate
## 135          Annual official estimate
## 136                 Official estimate
## 137       Quarterly official estimate
## 138                 Official estimate
## 139         Monthly official estimate
## 140          Annual official estimate
## 141          Annual official estimate
## 142         Monthly official estimate
## 143                     UN projection
## 144          Final 2011 census result
## 145                 Official estimate
## 146         Official population clock
## 147          Final 2011 census result
## 148         Monthly official estimate
## 149    Preliminary 2013 census result
## 150        Official annual projection
## 151                     UN projection
## 152                     UN projection
## 153          Annual official estimate
## 154                2011 census result
## 155        Official annual projection
## 156                 Official estimate
## 157                 Official estimate
## 158                 Official estimate
## 159               Official projection
## 160                     UN projection
## 161          Annual official estimate
## 162                 Official estimate
## 163          Official annual estimate
## 164                 Official estimate
## 165         Official population clock
## 166                 Official estimate
## 167       Official quarterly estimate
## 168          Final 2011 census result
## 169          Annual official estimate
## 170          Annual official estimate
## 171    Preliminary 2012 census result
## 172        Official annual projection
## 173    Preliminary 2014 census result
## 174                 Official estimate
## 175          Official annual estimate
## 176          Official annual estimate
## 177    Preliminary 2011 census result
## 178          Official annual estimate
## 179          Annual official estimate
## 180                 Official estimate
## 181    Preliminary 2014 census result
## 182          Annual official estimate
## 183                   Official census
## 184                 Official estimate
## 185    Preliminary 2014 census result
## 186    Preliminary 2012 census result
## 187          Annual official estimate
## 188                   Official census
## 189          Annual official estimate
## 190                2012 census result
## 191          Final 2011 census result
## 192                2012 census result
## 193                     UN projection
## 194          Final 2010 census result
## 195          Annual official estimate
## 196                     UN projection
## 197       Official quarterly estimate
## 198          Annual official estimate
## 199          Final 2010 census result
## 200                2011 census result
## 201                2011 census result
## 202          Annual official estimate
## 203          Annual official estimate
## 204          Annual official estimate
## 205    Preliminary 2011 census result
## 206                2011 census result
## 207          Annual official estimate
## 208    Preliminary 2011 census result
## 209          Final 2010 census result
## 210          Annual official estimate
## 211          Annual official estimate
## 212          Annual official estimate
## 213                 Official estimate
## 214          Final 2010 census result
## 215                     UN projection
## 216          Final 2010 census result
## 217                          Estimate
## 218         Monthly official estimate
## 219                 Official estimate
## 220     Semi annual official estimate
## 221          Annual official estimate
## 222          Annual official estimate
## 223         Monthly official estimate
## 224                2012 census result
## 225          Annual official estimate
## 226                 Official estimate
## 227                2010 census result
## 228                 Official estimate
## 229          Annual official estimate
## 230          Final 2011 census result
## 231    Preliminary 2011 census result
## 232          Annual official estimate
## 233          Annual official estimate
## 234                2011 census result
## 235          Annual official estimate
## 236          Annual official estimate
## 237                2011 census result
## 238                     UN projection
## 239                     UN projection
## 240                 Official estimate
## 241                2011 census result
## 242                2011 census result
## 243          Final 2011 census result
## 244          Final 2011 census result
## 245                 Official estimate
## 246                2011 census result
## 247                 Official estimate
html_tables[[2]]
##   List of countries by population (United Nations)\nList of sovereign states and dependent territories by population density\nList of sovereign states and dependent territories by fertility rate\nList of countries by population growth rate\nList of contine ...
## 1                                                                                                                                                                                                                                                                   
##   Geography portal\n\nLists of countries by population\nContinental\n\nAfrica\nAsia\nEurope\nNorth America\nOceania\nSouth America\n\nIntercontinental\n\nArab states\nAmericas\nEurasia\nLatin America\nCommonwealth of Nations\nMiddle East\n\nSubcontinental\n\nCaribbean island ...
## 1                                                                                                                                                                                                                                                                      Geography portal
html_tables[[3]]
## NULL
html_tables[[4]]
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          V1
## 1  v\nt\ne\n\nLists of countries by population statistics\n\n\nPopulation\n\n\nCurrent population\nCurrent population (inc. dependent territories)\nCurrent population (graphical)\nPopulation in 1900\nPopulation in 1907\nPopulation in 2000\nPopulation in 2010\nPopulation (United Nations statistics)\nPopulation growth rate\nnatural increase\npast and future population\npopulation milestones\ncitizen population (domestic)\n\n\n\nPopulation density\n\n\nCurrent density\nCurrent real density based on food growing capacity\n\n\n\n(Regional)\n\n\n\nPopulation of national capitals\nPopulation of cities proper\nPopulation of urban areas\n\n\n\n\nOther Demographics\n\n\nAge at first marriage\nDivorce rate\nEthnic and cultural diversity level\nForeign-born population\nImmigrant population\nMedian age\nNet migration rate\nNumber of households\nSex ratio\nUrban population\nUrbanization\n\n\n\nHealth\n\n\nAntiviral medications for pandemic influenza\nBirth rate\nMortality rate\nFertility rate\nHIV/AIDS adult prevalence rate\nInfant mortality rate\nLife expectancy\nObesity\nPercentage suffering from undernourishment\nHealth expenditure covered by government\nSuicide rate\nTotal health expenditure (PPP) per capita\n\n\n\nEducation and innovation\n\n\n25–34 year olds having a tertiary education degree\nBloomberg Innovation Index\nEducation Index\nInternational Innovation Index\nInnovation Union Scoreboard\nLiteracy rate\nProgramme for the International Assessment of Adult Competencies\nProgramme for International Student Assessment\nProgress in International Reading Literacy Study\nTrends in International Mathematics and Science Study\nWomen's average years in school\nWorld Intellectual Property Indicators\n\n\n\nEconomic\n\n\nDevelopment aid given\nForeign aid received\n\nEmployment rate\nIrrigated land area\nHuman Development Index\nby country\ninequality-adjusted\n\nHuman Poverty Index\nImports\nIncome equality\nJob security\nLabour force\nNumber of millionaires (US dollars)\nNumber of billionaires (US dollars)\nPercentage living in poverty\nSen social welfare function\nUnemployment rate\n\n\n\n\n\n\nList of international rankings\nList of top international rankings by country\nLists by country
## 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    v\nt\ne\n\nLists of countries by population statistics
## 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
## 4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Population
## 5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
## 6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Population density
## 7                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
## 8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Regional)
## 9                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
## 10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Other Demographics
## 11                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
## 12                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Health
## 13                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
## 14                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Education and innovation
## 15                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
## 16                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Economic
## 17                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
## 18                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          List of international rankings\nList of top international rankings by country\nLists by country
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 V2
## 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 2                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 4                                                                                                                          Current population\nCurrent population (inc. dependent territories)\nCurrent population (graphical)\nPopulation in 1900\nPopulation in 1907\nPopulation in 2000\nPopulation in 2010\nPopulation (United Nations statistics)\nPopulation growth rate\nnatural increase\npast and future population\npopulation milestones\ncitizen population (domestic)
## 5                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 6                                                                                                                                                                                                                                                                                                                                                                                                             Current density\nCurrent real density based on food growing capacity
## 7                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 8                                                                                                                                                                                                                                                                                                                                                                                          Population of national capitals\nPopulation of cities proper\nPopulation of urban areas
## 9                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 10                                                                                                                                                                                                                                                        Age at first marriage\nDivorce rate\nEthnic and cultural diversity level\nForeign-born population\nImmigrant population\nMedian age\nNet migration rate\nNumber of households\nSex ratio\nUrban population\nUrbanization
## 11                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 12                                                                                                                                                        Antiviral medications for pandemic influenza\nBirth rate\nMortality rate\nFertility rate\nHIV/AIDS adult prevalence rate\nInfant mortality rate\nLife expectancy\nObesity\nPercentage suffering from undernourishment\nHealth expenditure covered by government\nSuicide rate\nTotal health expenditure (PPP) per capita
## 13                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 14 25–34 year olds having a tertiary education degree\nBloomberg Innovation Index\nEducation Index\nInternational Innovation Index\nInnovation Union Scoreboard\nLiteracy rate\nProgramme for the International Assessment of Adult Competencies\nProgramme for International Student Assessment\nProgress in International Reading Literacy Study\nTrends in International Mathematics and Science Study\nWomen's average years in school\nWorld Intellectual Property Indicators
## 15                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 16                                                                                              Development aid given\nForeign aid received\n\nEmployment rate\nIrrigated land area\nHuman Development Index\nby country\ninequality-adjusted\n\nHuman Poverty Index\nImports\nIncome equality\nJob security\nLabour force\nNumber of millionaires (US dollars)\nNumber of billionaires (US dollars)\nPercentage living in poverty\nSen social welfare function\nUnemployment rate
## 17                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 18                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
html_tables[[5]]
##                                                                                                 V1
## 1                                                                                                 
## 2                                                                                       Population
## 3                                                                                                 
## 4                                                                               Population density
## 5                                                                                                 
## 6                                                                                       (Regional)
## 7                                                                                                 
## 8                                                                               Other Demographics
## 9                                                                                                 
## 10                                                                                          Health
## 11                                                                                                
## 12                                                                        Education and innovation
## 13                                                                                                
## 14                                                                                        Economic
## 15                                                                                                
## 16 List of international rankings\nList of top international rankings by country\nLists by country
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 V2
## 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 2                                                                                                                          Current population\nCurrent population (inc. dependent territories)\nCurrent population (graphical)\nPopulation in 1900\nPopulation in 1907\nPopulation in 2000\nPopulation in 2010\nPopulation (United Nations statistics)\nPopulation growth rate\nnatural increase\npast and future population\npopulation milestones\ncitizen population (domestic)
## 3                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 4                                                                                                                                                                                                                                                                                                                                                                                                             Current density\nCurrent real density based on food growing capacity
## 5                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 6                                                                                                                                                                                                                                                                                                                                                                                          Population of national capitals\nPopulation of cities proper\nPopulation of urban areas
## 7                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 8                                                                                                                                                                                                                                                         Age at first marriage\nDivorce rate\nEthnic and cultural diversity level\nForeign-born population\nImmigrant population\nMedian age\nNet migration rate\nNumber of households\nSex ratio\nUrban population\nUrbanization
## 9                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <NA>
## 10                                                                                                                                                        Antiviral medications for pandemic influenza\nBirth rate\nMortality rate\nFertility rate\nHIV/AIDS adult prevalence rate\nInfant mortality rate\nLife expectancy\nObesity\nPercentage suffering from undernourishment\nHealth expenditure covered by government\nSuicide rate\nTotal health expenditure (PPP) per capita
## 11                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 12 25–34 year olds having a tertiary education degree\nBloomberg Innovation Index\nEducation Index\nInternational Innovation Index\nInnovation Union Scoreboard\nLiteracy rate\nProgramme for the International Assessment of Adult Competencies\nProgramme for International Student Assessment\nProgress in International Reading Literacy Study\nTrends in International Mathematics and Science Study\nWomen's average years in school\nWorld Intellectual Property Indicators
## 13                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 14                                                                                              Development aid given\nForeign aid received\n\nEmployment rate\nIrrigated land area\nHuman Development Index\nby country\ninequality-adjusted\n\nHuman Poverty Index\nImports\nIncome equality\nJob security\nLabour force\nNumber of millionaires (US dollars)\nNumber of billionaires (US dollars)\nPercentage living in poverty\nSen social welfare function\nUnemployment rate
## 15                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>
## 16                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <NA>

8 Identify your web browser, and describe (in one or two sentences)

how you view HTML page source in your web browser.

I use both MS internet Explorer and Google Chrome MS internet Explorer. To view the page source, just go to the main menu, choose view, then select source. In Google Chrome, from main menu, choose more tools, then select view source

9 (Optional challenge exercise)

Instead of using readHTMLTable from the XML package, use the functionality in the rvest package to # perform the same task.

Which method do you prefer? Why might one prefer one package over the other?

url_rvest <- html("http://www.jaredlander.com/2012/02/another-kind-of-super-bowl-pool/")

bowlPool_rvest <- html_table(url_rvest)
class(bowlPool_rvest)
## [1] "list"
length(bowlPool_rvest)
## [1] 1
str(bowlPool_rvest)
## List of 1
##  $ :'data.frame':    10 obs. of  3 variables:
##   ..$ X1: chr [1:10] "Participant 1" "Participant 2" "Participant 3" "Participant 4" ...
##   ..$ X2: chr [1:10] "Giant A" "Giant B" "Giant C" "Giant D" ...
##   ..$ X3: chr [1:10] "Patriot Q" "Patriot R" "Patriot S" "Patriot T" ...
# using the table_count function above. there is only 1 table.
table_count(bowlPool_rvest)
## [1] 1
# Validating the data. only html_tbl_9[1] is a table.
bowlPool_rvest[[1]]
##                X1      X2        X3
## 1   Participant 1 Giant A Patriot Q
## 2   Participant 2 Giant B Patriot R
## 3   Participant 3 Giant C Patriot S
## 4   Participant 4 Giant D Patriot T
## 5   Participant 5 Giant E Patriot U
## 6   Participant 6 Giant F Patriot V
## 7   Participant 7 Giant G Patriot W
## 8   Participant 8 Giant H Patriot X
## 9   Participant 9 Giant I Patriot Y
## 10 Participant 10 Giant J Patriot Z

using str() below, interesting rvest returns a list of 1 data frame element. readHTMLTable returns # # data frame with

multiple vectors. Also, the length is different. In rvest the length is 1. using readHTMLTable,

the length is 3.

str(bowlPool_rvest)
## List of 1
##  $ :'data.frame':    10 obs. of  3 variables:
##   ..$ X1: chr [1:10] "Participant 1" "Participant 2" "Participant 3" "Participant 4" ...
##   ..$ X2: chr [1:10] "Giant A" "Giant B" "Giant C" "Giant D" ...
##   ..$ X3: chr [1:10] "Patriot Q" "Patriot R" "Patriot S" "Patriot T" ...
str(bowlPool)
## 'data.frame':    10 obs. of  3 variables:
##  $ V1: chr  "Participant 1" "Participant 2" "Participant 3" "Participant 4" ...
##  $ V2: chr  "Giant A" "Giant B" "Giant C" "Giant D" ...
##  $ V3: chr  "Patriot Q" "Patriot R" "Patriot S" "Patriot T" ...
length(bowlPool_rvest)
## [1] 1
length(bowlPool)
## [1] 3