Objetivos

¿Qué es R ?

R es un ambiente de programación formado por un conjunto de herramientas muy flexibles que pueden ampliarse fácilmente mediante paquetes, librerías o definiendo nuestras propias funciones. Además es gratuito y de código abierto, un Open Source parte del proyecto GNU, como Linux o Mozilla Firefox

Puedes ver la documentación oficial de R con help.start(). ¿Hace falta leerla? No

http://gauss.inf.um.es/videos/whatsR.webm

Importancia de R

¿Por qué usar R?

Instalación

Instalación Directamente desde:

R install

R studio

Descargar desde: https://rstudio.com

Interface de usuario para R, potente, sencillo Software LIBRE. Versiones para linux, Mac, Windows

Otra alternativa

Rstudio-cloud https://rstudio.cloud/

¿Qué tiene R que tanto nos gusta?:

Una vez estamos en RStudio, podemos escribir y ejecutar las órdenes de varias formas:

directamente en la consola a través de un script (.R) con ficheros Rmarkdown (.Rmd) Como podemos ver, RStudio está (normalmente) dividido en 4 paneles.

Consola.

Por defecto, la consola se encuentra en el panel inferior-izquierdo. ¿Vemos la pestaña que pone Console? Inmediatamente debajo aparece un texto informativo y, finalmente, el símbolo “>”. Aquí es donde R espera que le demos instrucciones. Para ejecutarlas y obtener el resultado pulsamos enter.

Scripts.

Trabajar en la consola es muy limitado ya que las instrucciones se han de introducir una a una. Lo habitual es trabajar con scripts o ficheros de instrucciones. Estos ficheros tienen extensión .R.

Se puede crear una script con cualquier editor de texto (uno de los más populares es Tinn-R), pero nosotros lo haremos desde RStudio. Para ello, seleccionamos la siguiente ruta de menús: File > New File > R script

Entorno.

El panel, llamémoslo, de entorno esta compuesto de dos pestañas: Environment y History.

En el Environment se irán registrando los objetos que vayamos creando en la sesión de trabajo. También tenemos la opción de cargar y guardar una sesión de trabajo, importar datos y limpiar los objetos de la sesión. Estas opciones están accesibles a través de la cinta de opciones de la pestaña.

En la pestaña History se registran las instrucciones ejecutadas. Como opciones, podemos cargar y guardar el historial de la sesión, seleccionar una o más instrucciones y enviarlas bien a la consola bien al script, y limpiar el historial.

Miscelánea: Archivos, Gráficos, Paquetes, Ayuda, Visor.

Con el nombre de Misceléna nos referimos al panel que se encuentra en la parte inferior-derecha del escritorio de RStudio.

En este panel cabe destacar las siguientes pestañas, cada una con diferentes opciones:

  • Files: es una especie de explotador de ficheros.
  • Plots: donde se visualizan los gráficos que creamos. Entre las opciones disponibles se encuentran:
  • Zoom: para agrandar el gráfico y verlo en otra ventana.
  • Export: para exportar/guardar el gráfico. Se puede guardar el gráfico como imagen, pdf o copiarlo al portapapeles.
  • Packages: proporciona un listado de los paquetes instalados en R y los que han sido cargado en la sesión. A través de las opciones de esta pestaña podemos instalar nuevos paquetes o actualizar los existentes.
  • Help: Para obtener ayuda sobre una determinada función.

Instalar y cargar paquetes.

R está compuesto por un sistema base, pero para extender su funcionalidad es necesario instalar paquetes adicionales.

Podemos instalar paquetes de varias formas:

install.packages("dplyr") # dplyr es un paquete que se utiliza para manipular/gestionar datos

Operadores aritméticos

Operador Cantidad
^ Potencia
+ - Suma resta
* / Multiplicación División
%/% Cociente entero
%% Modulo
: Generar una serie
%*% Producto matricial
3^2
## [1] 9
5.6*4
## [1] 22.4
39/8
## [1] 4.875
9%/%4
## [1] 2
9%%4
## [1] 1
8/3*4
## [1] 10.66667
1:10
##  [1]  1  2  3  4  5  6  7  8  9 10
1:10*3
##  [1]  3  6  9 12 15 18 21 24 27 30

Operadores lógicos

Operador Descripcion
! no
= != igual distinto
> >= mayor, mayor o igual
< <= menor, menor o igual
\(|\) \(||\) o
& && y
# Comentario
3 >=2
## [1] TRUE
0 != 0.0000000000000001
## [1] TRUE
5*2 > 9 & 3/2 == 1.5
## [1] TRUE
(3<5) & (4< -4.5)
## [1] FALSE
(3<5) || (4< -4.5)
## [1] TRUE

Asignaciones

Operador Cantidad
\(\texttt{<-}\) Asignar a la izquierda
\(\texttt{->}\) Asignar a la derecha
\(=\) Asignar a la izquierda
a <- 3
a
## [1] 3
a <- a + 1
a
## [1] 4
(a <- a + 1)
## [1] 5

Funciones

  • Una función es un procedimiento para realizar una determinada tarea o cálculo
  • función se asocia a un nombre, que sigue las mismas reglas que las variables
  • nombre_de_la_función ( argumento \(1\), argumento 2, . . . )
  • Los argumentos son propios de cada función
  • En algunos casos los argumentos tienen valores por defecto

\(\ln(2)\)

log( 2 )
## [1] 0.6931472

\(\log_{10} 2\)

log( 2, 10 )
## [1] 0.30103

\(\ln(e^{1})\)

log( exp( 1 ) )
## [1] 1

Funciones

Vectores

x <- c( 8, 5, 2, 4, 1, 6, 3 )

Longitud del vector \(x\)

length( x )
## [1] 7

Imprime el vector \(x\)

x
## [1] 8 5 2 4 1 6 3
x[]
## [1] 8 5 2 4 1 6 3

Extrae el primer elemento del vector \(x\)

x[ 1 ]
## [1] 8
x[ 2:4 ]
## [1] 5 2 4
x[ c( 3, 5 ) ]
## [1] 2 1
x[ -1 ]
## [1] 5 2 4 1 6 3

Matrices

  • Una matriz es un conjunto ordenado de vectores
  • Los elementos de la matriz están ordenados por filas y columnas
  • Todos los vectores son del mismo tipo: enteros, caracteres, . . .
  • Los elementos de una matriz se identifican por dos subíndices
  • El uso de los subíndices sigue las mismas reglas que en el caso de los vectores
  • Se puede crear uniendo vectores o mediante la función \(\texttt{matrix()}\)
m <- matrix( 1:12, 4, 3 )
m
##      [,1] [,2] [,3]
## [1,]    1    5    9
## [2,]    2    6   10
## [3,]    3    7   11
## [4,]    4    8   12
m[ 1, ]
## [1] 1 5 9

En R hay varias formas de crear una matriz:

Mediante los operadores \(\texttt{rbind()}\) (para pegar vectores por filas) y \(\texttt{cbind()}\) (para pegar vectores por columnas)

matriz = rbind (x1, x2,…) matriz = cbind (x1, x2…)

donde en la función \(\texttt{rbind()}\), x1 y x2, son las filas de la matriz, y en la función \(\texttt{cbind()}\) las columnas.

M = matrix( 1: 9, nrow = 3, byrow = TRUE) # la matriz se rrellena por filas
M
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    4    5    6
## [3,]    7    8    9

la matriz se rrellena por columnas

 N = matrix( 1: 9, nrow = 3, byrow = FALSE) # 
 N
##      [,1] [,2] [,3]
## [1,]    1    4    7
## [2,]    2    5    8
## [3,]    3    6    9
matrix(1:10,  5,  2, dimnames = list (c ("fila1", "fila2", "fila3", "fila4", "fila5"),  c("columna1", "columna2")))
##       columna1 columna2
## fila1        1        6
## fila2        2        7
## fila3        3        8
## fila4        4        9
## fila5        5       10
 matrix(1:15, 3, 5)
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    4    7   10   13
## [2,]    2    5    8   11   14
## [3,]    3    6    9   12   15

Nota: Cuando la longitud del vector no coincide con el número de filas y columnas, los elementos de la matriz se repiten, por lo que R te da un warning advirtiendo que las salidas pueden no ser las deseadas.

Datos tabulares (o de texto)

Estamos acostumbrados a visualizar datos en formato tabular; es decir, como una tabla. Generalmente las columnas son variables y las filas son observaciones de esas variables para diferentes unidades de análisis (“individuos”).

Las columnas se separan con un carácter (generalmente la coma) y las filas con un salto de linea.

Podemos pensar que dependiendo de como se separen las observaciones tenemos distintos tipos de datos tabulares, pero en realidad su estructura es similar: variables en columnas y las observaciones de un individuo separadas por una marca o carácter. Este carácter puede ser un espacio, un tabulador, una coma, punto y coma etc… El formato tabular mas extendido es el CSV, donde las observaciones están separadas por comas.

Estos datos se pueden visualizar en los editores de texto y por eso también se llaman datos en formato texto.

Podemos pensar que hay 2 grupos de datos tabulares: - delimitados por caracteres - de anchura fija

El package readr lee datos tabulares con las siguientes funciones:

Sólo veremos como importar/exportar datos tabulares del primer tipo; es decir, separados por caracteres. Comenzaremos con el formato CSV que es el más utilizado.

#install.packages("gapminder")  # para cargar la base de datos a usar hoy
#install.packages("tidyverse")
library(gapminder)  # datos
library(dplyr)      # Paquete para manipular los datos
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Visualización de la base de datos.

Recuerde: Filas=individuos y Columnas=variables

library(DT)
DT::datatable(gapminder)

Nombres de las variables

colnames(gapminder)
## [1] "country"   "continent" "year"      "lifeExp"   "pop"       "gdpPercap"

Dimensión de la base de datos

dim(gapminder)  # 
## [1] 1704    6

1704 filas y 6 columnas

Información sobre las variables

str(gapminder)  #
## tibble [1,704 × 6] (S3: tbl_df/tbl/data.frame)
##  $ country  : Factor w/ 142 levels "Afghanistan",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ continent: Factor w/ 5 levels "Africa","Americas",..: 3 3 3 3 3 3 3 3 3 3 ...
##  $ year     : int [1:1704] 1952 1957 1962 1967 1972 1977 1982 1987 1992 1997 ...
##  $ lifeExp  : num [1:1704] 28.8 30.3 32 34 36.1 ...
##  $ pop      : int [1:1704] 8425333 9240934 10267083 11537966 13079460 14880372 12881816 13867957 16317921 22227415 ...
##  $ gdpPercap: num [1:1704] 779 821 853 836 740 ...

gapminder es el nombre de la base de datos

LLamar una variable

gapminder$pop
##    [1]    8425333    9240934   10267083   11537966   13079460   14880372
##    [7]   12881816   13867957   16317921   22227415   25268405   31889923
##   [13]    1282697    1476505    1728137    1984060    2263554    2509048
##   [19]    2780097    3075321    3326498    3428038    3508512    3600523
##   [25]    9279525   10270856   11000948   12760499   14760787   17152804
##   [31]   20033753   23254956   26298373   29072015   31287142   33333216
##   [37]    4232095    4561361    4826015    5247469    5894858    6162675
##   [43]    7016384    7874230    8735988    9875024   10866106   12420476
##   [49]   17876956   19610538   21283783   22934225   24779799   26983828
##   [55]   29341374   31620918   33958947   36203463   38331121   40301927
##   [61]    8691212    9712569   10794968   11872264   13177000   14074100
##   [67]   15184200   16257249   17481977   18565243   19546792   20434176
##   [73]    6927772    6965860    7129864    7376998    7544201    7568430
##   [79]    7574613    7578903    7914969    8069876    8148312    8199783
##   [85]     120447     138655     171863     202182     230800     297410
##   [91]     377967     454612     529491     598561     656397     708573
##   [97]   46886859   51365468   56839289   62821884   70759295   80428306
##  [103]   93074406  103764241  113704579  123315288  135656790  150448339
##  [109]    8730405    8989111    9218400    9556500    9709100    9821800
##  [115]    9856303    9870200   10045622   10199787   10311970   10392226
##  [121]    1738315    1925173    2151895    2427334    2761407    3168267
##  [127]    3641603    4243788    4981671    6066080    7026113    8078314
##  [133]    2883315    3211738    3593918    4040665    4565872    5079716
##  [139]    5642224    6156369    6893451    7693188    8445134    9119152
##  [145]    2791000    3076000    3349000    3585000    3819000    4086000
##  [151]    4172693    4338977    4256013    3607000    4165416    4552198
##  [157]     442308     474639     512764     553541     619351     781472
##  [163]     970347    1151184    1342614    1536536    1630347    1639131
##  [169]   56602560   65551171   76039390   88049823  100840058  114313951
##  [175]  128962939  142938076  155975974  168546719  179914212  190010647
##  [181]    7274900    7651254    8012946    8310226    8576200    8797022
##  [187]    8892098    8971958    8658506    8066057    7661799    7322858
##  [193]    4469979    4713416    4919632    5127935    5433886    5889574
##  [199]    6634596    7586551    8878303   10352843   12251209   14326203
##  [205]    2445618    2667518    2961915    3330989    3529983    3834415
##  [211]    4580410    5126023    5809236    6121610    7021078    8390505
##  [217]    4693836    5322536    6083619    6960067    7450606    6978607
##  [223]    7272485    8371791   10150094   11782962   12926707   14131858
##  [229]    5009067    5359923    5793633    6335506    7021028    7959865
##  [235]    9250831   10780667   12467171   14195809   15929988   17696293
##  [241]   14785584   17010154   18985849   20819767   22284500   23796400
##  [247]   25201900   26549700   28523502   30305843   31902268   33390141
##  [253]    1291695    1392284    1523478    1733638    1927260    2167533
##  [259]    2476971    2840009    3265124    3696513    4048013    4369038
##  [265]    2682462    2894855    3150417    3495967    3899068    4388260
##  [271]    4875118    5498955    6429417    7562011    8835739   10238807
##  [277]    6377619    7048426    7961258    8858908    9717524   10599793
##  [283]   11487112   12463354   13572994   14599929   15497046   16284741
##  [289]  556263527  637408000  665770000  754550000  862030000  943455000
##  [295] 1000281000 1084035000 1164970000 1230075000 1280400000 1318683096
##  [301]   12350771   14485993   17009885   19764027   22542890   25094412
##  [307]   27764644   30964245   34202721   37657830   41008227   44227550
##  [313]     153936     170928     191689     217378     250027     304739
##  [319]     348643     395114     454429     527982     614382     710960
##  [325]   14100005   15577932   17486434   19941073   23007669   26480870
##  [331]   30646495   35481645   41672143   47798986   55379852   64606759
##  [337]     854885     940458    1047924    1179760    1340458    1536769
##  [343]    1774735    2064095    2409073    2800947    3328795    3800610
##  [349]     926317    1112300    1345187    1588717    1834796    2108457
##  [355]    2424367    2799811    3173216    3518107    3834934    4133884
##  [361]    2977019    3300000    3832408    4744870    6071696    7459574
##  [367]    9025951   10761098   12772596   14625967   16252726   18013409
##  [373]    3882229    3991242    4076557    4174366    4225310    4318673
##  [379]    4413368    4484310    4494013    4444595    4481020    4493312
##  [385]    6007797    6640752    7254373    8139332    8831348    9537988
##  [391]    9789224   10239839   10723260   10983007   11226999   11416987
##  [397]    9125183    9513758    9620282    9835109    9862158   10161915
##  [403]   10303704   10311597   10315702   10300707   10256295   10228744
##  [409]    4334000    4487831    4646899    4838800    4991596    5088419
##  [415]    5117810    5127024    5171393    5283663    5374693    5468120
##  [421]      63149      71851      89898     127617     178848     228694
##  [427]     305991     311025     384156     417908     447416     496374
##  [433]    2491346    2923186    3453434    4049146    4671329    5302800
##  [439]    5968349    6655297    7351181    7992357    8650322    9319622
##  [445]    3548753    4058385    4681707    5432424    6298651    7278866
##  [451]    8365850    9545158   10748394   11911819   12921234   13755680
##  [457]   22223309   25009741   28173309   31681188   34807417   38783863
##  [463]   45681811   52799062   59402198   66134291   73312559   80264543
##  [469]    2042865    2355805    2747687    3232927    3790903    4282586
##  [475]    4474873    4842194    5274649    5783439    6353681    6939688
##  [481]     216964     232922     249220     259864     277603     192675
##  [487]     285483     341244     387838     439971     495627     551201
##  [493]    1438760    1542611    1666618    1820319    2260187    2512642
##  [499]    2637297    2915959    3668440    4058319    4414865    4906585
##  [505]   20860941   22815614   25145372   27860297   30770372   34617799
##  [511]   38111756   42999530   52088559   59861301   67946797   76511887
##  [517]    4090500    4324000    4491443    4605744    4639657    4738902
##  [523]    4826933    4931729    5041039    5134406    5193039    5238460
##  [529]   42459667   44310863   47124000   49569000   51732000   53165019
##  [535]   54433565   55630100   57374179   58623428   59925035   61083916
##  [541]     420702     434904     455661     489004     537977     706367
##  [547]     753874     880397     985739    1126189    1299304    1454867
##  [553]     284320     323150     374020     439593     517101     608274
##  [559]     715523     848406    1025384    1235767    1457766    1688359
##  [565]   69145952   71019069   73739117   76368453   78717088   78160773
##  [571]   78335266   77718298   80597764   82011073   82350671   82400996
##  [577]    5581001    6391288    7355248    8490213    9354120   10538093
##  [583]   11400338   14168101   16278738   18418288   20550751   22873338
##  [589]    7733250    8096218    8448233    8716441    8888628    9308479
##  [595]    9786480    9974490   10325429   10502372   10603863   10706290
##  [601]    3146381    3640876    4208858    4690773    5149581    5703430
##  [607]    6395630    7326406    8486949    9803875   11178650   12572928
##  [613]    2664249    2876726    3140003    3451418    3811387    4227026
##  [619]    4710497    5650262    6990574    8048834    8807818    9947814
##  [625]     580653     601095     627820     601287     625361     745228
##  [631]     825987     927524    1050938    1193708    1332459    1472041
##  [637]    3201488    3507701    3880130    4318137    4698301    4908554
##  [643]    5198399    5756203    6326682    6913545    7607651    8502814
##  [649]    1517453    1770390    2090162    2500689    2965146    3055235
##  [655]    3669448    4372203    5077347    5867957    6677328    7483763
##  [661]    2125900    2736300    3305200    3722800    4115700    4583700
##  [667]    5264500    5584510    5829696    6495918    6762476    6980412
##  [673]    9504000    9839000   10063000   10223422   10394091   10637171
##  [679]   10705535   10612740   10348684   10244684   10083313    9956108
##  [685]     147962     165110     182053     198676     209275     221823
##  [691]     233997     244676     259012     271192     288030     301931
##  [697]  372000000  409000000  454000000  506000000  567000000  634000000
##  [703]  708000000  788000000  872000000  959000000 1034172547 1110396331
##  [709]   82052000   90124000   99028000  109343000  121282000  136725000
##  [715]  153343000  169276000  184816000  199278000  211060000  223547000
##  [721]   17272000   19792000   22874000   26538000   30614000   35480679
##  [727]   43072751   51889696   60397973   63327987   66907826   69453570
##  [733]    5441766    6248643    7240260    8519282   10061506   11882916
##  [739]   14173318   16543189   17861905   20775703   24001816   27499638
##  [745]    2952156    2878220    2830000    2900100    3024400    3271900
##  [751]    3480000    3539900    3557761    3667233    3879155    4109086
##  [757]    1620914    1944401    2310904    2693585    3095893    3495918
##  [763]    3858421    4203148    4936550    5531387    6029529    6426679
##  [769]   47666000   49182000   50843200   52667100   54365564   56059245
##  [775]   56535636   56729703   56840847   57479469   57926999   58147733
##  [781]    1426095    1535090    1665128    1861096    1997616    2156814
##  [787]    2298309    2326606    2378618    2531311    2664659    2780132
##  [793]   86459025   91563009   95831757  100825279  107188273  113872473
##  [799]  118454974  122091325  124329269  125956499  127065841  127467972
##  [805]     607914     746559     933559    1255058    1613551    1937652
##  [811]    2347031    2820042    3867409    4526235    5307470    6053193
##  [817]    6464046    7454779    8678557   10191512   12044785   14500404
##  [823]   17661452   21198082   25020539   28263827   31386842   35610177
##  [829]    8865488    9411381   10917494   12617009   14781241   16325320
##  [835]   17647518   19067554   20711375   21585105   22215365   23301725
##  [841]   20947571   22611552   26420307   30131000   33505000   36436000
##  [847]   39326000   41622000   43805450   46173816   47969150   49044790
##  [853]     160000     212846     358266     575003     841934    1140357
##  [859]    1497494    1891487    1418095    1765345    2111561    2505559
##  [865]    1439529    1647412    1886848    2186894    2680018    3115787
##  [871]    3086876    3089353    3219994    3430388    3677780    3921278
##  [877]     748747     813338     893143     996380    1116779    1251524
##  [883]    1411807    1599200    1803195    1982823    2046772    2012649
##  [889]     863308     975950    1112796    1279406    1482628    1703617
##  [895]    1956875    2269414    1912974    2200725    2814651    3193942
##  [901]    1019729    1201578    1441863    1759224    2183877    2721783
##  [907]    3344074    3799845    4364501    4759670    5368585    6036914
##  [913]    4762912    5181679    5703324    6334556    7082430    8007166
##  [919]    9171477   10568642   12210395   14165114   16473477   19167654
##  [925]    2917802    3221238    3628608    4147252    4730997    5637246
##  [931]    6502825    7824747   10014249   10419991   11824495   13327079
##  [937]    6748378    7739235    8906385   10154878   11441462   12845381
##  [943]   14441916   16331785   18319502   20476091   22662365   24821286
##  [949]    3838168    4241884    4690372    5212416    5828158    6491649
##  [955]    6998256    7634008    8416215    9384984   10580176   12031795
##  [961]    1022556    1076852    1146757    1230542    1332786    1456688
##  [967]    1622136    1841240    2119465    2444741    2828858    3270065
##  [973]     516556     609816     701016     789309     851334     913025
##  [979]     992040    1042663    1096202    1149818    1200206    1250882
##  [985]   30144317   35015548   41121485   47995559   55984294   63759976
##  [991]   71640904   80122492   88111030   95895146  102479927  108700891
##  [997]     800663     882134    1010280    1149500    1320500    1528000
## [1003]    1756032    2015133    2312802    2494803    2674234    2874127
## [1009]     413834     442829     474528     501035     527678     560073
## [1015]     562548     569473     621621     692651     720230     684736
## [1021]    9939217   11406350   13056604   14770296   16660670   18396941
## [1027]   20198730   22987397   25798239   28529501   31167783   33757175
## [1033]    6446316    7038035    7788944    8680909    9809596   11127868
## [1039]   12587223   12891952   13160731   16603334   18473780   19951656
## [1045]   20092996   21731844   23634436   25870271   28466390   31528087
## [1051]   34680442   38028578   40546538   43247867   45598081   47761980
## [1057]     485831     548080     621392     706640     821782     977026
## [1063]    1099010    1278184    1554253    1774766    1972153    2055080
## [1069]    9182536    9682338   10332057   11261690   12412593   13933198
## [1075]   15796314   17917180   20326209   23001113   25873917   28901790
## [1081]   10381988   11026383   11805689   12596822   13329874   13852989
## [1087]   14310401   14665278   15174244   15604464   16122830   16570613
## [1093]    1994794    2229407    2488550    2728150    2929100    3164900
## [1099]    3210650    3317166    3437674    3676187    3908037    4115771
## [1105]    1165790    1358828    1590597    1865490    2182908    2554598
## [1111]    2979423    3344353    4017939    4609572    5146848    5675356
## [1117]    3379468    3692184    4076008    4534062    5060262    5682086
## [1123]    6437188    7332638    8392818    9666252   11140655   12894865
## [1129]   33119096   37173340   41871351   47287752   53740085   62209173
## [1135]   73039376   81551520   93364244  106207839  119901274  135031164
## [1141]    3327728    3491938    3638919    3786019    3933004    4043205
## [1147]    4114787    4186147    4286357    4405672    4535591    4627926
## [1153]     507833     561977     628164     714775     829050    1004533
## [1159]    1301048    1593882    1915208    2283635    2713462    3204897
## [1165]   41346560   46679944   53100671   60641899   69325921   78152686
## [1171]   91462088  105186881  120065004  135564834  153403524  169270617
## [1177]     940080    1063506    1215725    1405486    1616384    1839782
## [1183]    2036305    2253639    2484997    2734531    2990875    3242173
## [1189]    1555876    1770902    2009813    2287985    2614104    2984494
## [1195]    3366439    3886512    4483945    5154123    5884491    6667147
## [1201]    8025700    9146100   10516500   12132200   13954700   15990099
## [1207]   18125129   20195924   22430449   24748122   26769436   28674757
## [1213]   22438691   26072194   30325264   35356600   40850141   46850962
## [1219]   53456774   60017788   67185766   75012988   82995088   91077287
## [1225]   25730551   28235346   30329617   31785378   33039545   34621254
## [1231]   36227381   37740710   38370697   38654957   38625976   38518241
## [1237]    8526050    8817650    9019800    9103000    8970450    9662600
## [1243]    9859650    9915289    9927680   10156415   10433867   10642836
## [1249]    2227000    2260000    2448046    2648961    2847132    3080828
## [1255]    3279001    3444468    3585176    3759430    3859606    3942491
## [1261]     257700     308700     358900     414024     461633     492095
## [1267]     517810     562035     622191     684810     743981     798094
## [1273]   16630000   17829327   18680721   19284814   20662648   21658597
## [1279]   22356726   22686371   22797027   22562458   22404337   22276056
## [1285]    2534927    2822082    3051242    3451079    3992121    4657072
## [1291]    5507565    6349365    7290203    7212583    7852401    8860588
## [1297]      60011      61325      65345      70787      76595      86796
## [1303]      98593     110812     125911     145608     170372     199579
## [1309]    4005677    4419650    4943029    5618198    6472756    8128505
## [1315]   11254672   14619745   16945857   21229759   24501530   27601038
## [1321]    2755589    3054547    3430243    3965841    4588696    5260855
## [1327]    6147783    7171347    8307920    9535314   10870037   12267493
## [1333]    6860147    7271135    7616060    7971222    8313288    8686367
## [1339]    9032824    9230783    9826397   10336594   10111559   10150265
## [1345]    2143249    2295678    2467895    2662190    2879013    3140897
## [1351]    3464522    3868905    4260884    4578212    5359092    6144562
## [1357]    1127000    1445929    1750200    1977600    2152400    2325300
## [1363]    2651869    2794552    3235865    3802309    4197776    4553009
## [1369]    3558137    3844277    4237384    4442238    4593433    4827803
## [1375]    5048043    5199318    5302888    5383010    5410052    5447502
## [1381]    1489518    1533070    1582962    1646912    1694510    1746919
## [1387]    1861252    1945870    1999210    2011612    2011497    2009245
## [1393]    2526994    2780415    3080153    3428839    3840161    4353666
## [1399]    5828892    6921858    6099799    6633514    7753310    9118773
## [1405]   14264935   16151549   18356657   20997321   23935810   27129932
## [1411]   31140029   35933379   39964159   42835005   44433622   43997828
## [1417]   28549870   29841614   31158061   32850275   34513161   36439000
## [1423]   37983310   38880702   39549438   39855442   40152517   40448191
## [1429]    7982342    9128546   10421936   11737396   13016733   14116836
## [1435]   15410151   16495304   17587060   18698655   19576783   20378239
## [1441]    8504667    9753392   11183227   12716129   14597019   17104986
## [1447]   20367053   24725960   28227588   32160729   37090298   42292929
## [1453]     290243     326741     370006     420690     480105     551425
## [1459]     649901     779348     962344    1054486    1130269    1133066
## [1465]    7124673    7363802    7561588    7867931    8122293    8251648
## [1471]    8325260    8421403    8718867    8897619    8954175    9031088
## [1477]    4815000    5126000    5666000    6063000    6401400    6316424
## [1483]    6468126    6649942    6995447    7193761    7361757    7554661
## [1489]    3661549    4149908    4834621    5680812    6701172    7932503
## [1495]    9410494   11242847   13219062   15081016   17155814   19314747
## [1501]    8550362   10164215   11918938   13648692   15226039   16785196
## [1507]   18501390   19757799   20686918   21628605   22454239   23174294
## [1513]    8322925    9452826   10863958   12607312   14706593   17129565
## [1519]   19844382   23040630   26605473   30686889   34593779   38139640
## [1525]   21289402   25041917   29263397   34024249   39276153   44148285
## [1531]   48827160   52910342   56667095   60216677   62806748   65068149
## [1537]    1219113    1357445    1528098    1735550    2056351    2308582
## [1543]    2644765    3154264    3747553    4320890    4977378    5701579
## [1549]     662850     764900     887498     960155     975199    1039009
## [1555]    1116479    1191336    1183669    1138101    1101832    1056608
## [1561]    3647735    3950849    4286552    4786986    5303507    6005061
## [1567]    6734098    7724976    8523077    9231669    9770575   10276158
## [1573]   22235677   25670939   29788695   33411317   37492953   42404033
## [1579]   47328791   52881328   58179144   63047647   67308928   71158647
## [1585]    5824797    6675501    7688797    8900294   10190285   11457758
## [1591]   12939400   15283050   18252190   21210254   24739869   29170398
## [1597]   50430000   51430000   53292000   54959000   56079000   56179000
## [1603]   56339704   56981620   57866349   58808266   59912431   60776238
## [1609]  157553000  171984000  186538000  198712000  209896000  220239000
## [1615]  232187835  242803533  256894189  272911760  287675526  301139947
## [1621]    2252965    2424959    2598466    2748579    2829526    2873520
## [1627]    2953997    3045153    3149262    3262838    3363085    3447496
## [1633]    5439568    6702668    8143375    9709552   11515649   13503563
## [1639]   15620766   17910182   20265563   22374398   24287670   26084662
## [1645]   26246839   28998543   33796140   39463910   44655014   50533506
## [1651]   56142181   62826491   69940728   76048996   80908147   85262356
## [1657]    1030585    1070439    1133134    1142636    1089572    1261091
## [1663]    1425876    1691210    2104779    2826046    3389578    4018332
## [1669]    4963829    5498090    6120081    6740785    7407075    8403990
## [1675]    9657618   11219340   13367997   15826497   18701257   22211743
## [1681]    2672000    3016000    3421000    3900000    4506497    5216550
## [1687]    6100407    7272406    8381163    9417789   10595811   11746035
## [1693]    3080907    3646340    4277736    4995432    5861135    6642107
## [1699]    7636524    9216418   10704340   11404948   11926563   12311143
gapminder$country
##    [1] Afghanistan              Afghanistan             
##    [3] Afghanistan              Afghanistan             
##    [5] Afghanistan              Afghanistan             
##    [7] Afghanistan              Afghanistan             
##    [9] Afghanistan              Afghanistan             
##   [11] Afghanistan              Afghanistan             
##   [13] Albania                  Albania                 
##   [15] Albania                  Albania                 
##   [17] Albania                  Albania                 
##   [19] Albania                  Albania                 
##   [21] Albania                  Albania                 
##   [23] Albania                  Albania                 
##   [25] Algeria                  Algeria                 
##   [27] Algeria                  Algeria                 
##   [29] Algeria                  Algeria                 
##   [31] Algeria                  Algeria                 
##   [33] Algeria                  Algeria                 
##   [35] Algeria                  Algeria                 
##   [37] Angola                   Angola                  
##   [39] Angola                   Angola                  
##   [41] Angola                   Angola                  
##   [43] Angola                   Angola                  
##   [45] Angola                   Angola                  
##   [47] Angola                   Angola                  
##   [49] Argentina                Argentina               
##   [51] Argentina                Argentina               
##   [53] Argentina                Argentina               
##   [55] Argentina                Argentina               
##   [57] Argentina                Argentina               
##   [59] Argentina                Argentina               
##   [61] Australia                Australia               
##   [63] Australia                Australia               
##   [65] Australia                Australia               
##   [67] Australia                Australia               
##   [69] Australia                Australia               
##   [71] Australia                Australia               
##   [73] Austria                  Austria                 
##   [75] Austria                  Austria                 
##   [77] Austria                  Austria                 
##   [79] Austria                  Austria                 
##   [81] Austria                  Austria                 
##   [83] Austria                  Austria                 
##   [85] Bahrain                  Bahrain                 
##   [87] Bahrain                  Bahrain                 
##   [89] Bahrain                  Bahrain                 
##   [91] Bahrain                  Bahrain                 
##   [93] Bahrain                  Bahrain                 
##   [95] Bahrain                  Bahrain                 
##   [97] Bangladesh               Bangladesh              
##   [99] Bangladesh               Bangladesh              
##  [101] Bangladesh               Bangladesh              
##  [103] Bangladesh               Bangladesh              
##  [105] Bangladesh               Bangladesh              
##  [107] Bangladesh               Bangladesh              
##  [109] Belgium                  Belgium                 
##  [111] Belgium                  Belgium                 
##  [113] Belgium                  Belgium                 
##  [115] Belgium                  Belgium                 
##  [117] Belgium                  Belgium                 
##  [119] Belgium                  Belgium                 
##  [121] Benin                    Benin                   
##  [123] Benin                    Benin                   
##  [125] Benin                    Benin                   
##  [127] Benin                    Benin                   
##  [129] Benin                    Benin                   
##  [131] Benin                    Benin                   
##  [133] Bolivia                  Bolivia                 
##  [135] Bolivia                  Bolivia                 
##  [137] Bolivia                  Bolivia                 
##  [139] Bolivia                  Bolivia                 
##  [141] Bolivia                  Bolivia                 
##  [143] Bolivia                  Bolivia                 
##  [145] Bosnia and Herzegovina   Bosnia and Herzegovina  
##  [147] Bosnia and Herzegovina   Bosnia and Herzegovina  
##  [149] Bosnia and Herzegovina   Bosnia and Herzegovina  
##  [151] Bosnia and Herzegovina   Bosnia and Herzegovina  
##  [153] Bosnia and Herzegovina   Bosnia and Herzegovina  
##  [155] Bosnia and Herzegovina   Bosnia and Herzegovina  
##  [157] Botswana                 Botswana                
##  [159] Botswana                 Botswana                
##  [161] Botswana                 Botswana                
##  [163] Botswana                 Botswana                
##  [165] Botswana                 Botswana                
##  [167] Botswana                 Botswana                
##  [169] Brazil                   Brazil                  
##  [171] Brazil                   Brazil                  
##  [173] Brazil                   Brazil                  
##  [175] Brazil                   Brazil                  
##  [177] Brazil                   Brazil                  
##  [179] Brazil                   Brazil                  
##  [181] Bulgaria                 Bulgaria                
##  [183] Bulgaria                 Bulgaria                
##  [185] Bulgaria                 Bulgaria                
##  [187] Bulgaria                 Bulgaria                
##  [189] Bulgaria                 Bulgaria                
##  [191] Bulgaria                 Bulgaria                
##  [193] Burkina Faso             Burkina Faso            
##  [195] Burkina Faso             Burkina Faso            
##  [197] Burkina Faso             Burkina Faso            
##  [199] Burkina Faso             Burkina Faso            
##  [201] Burkina Faso             Burkina Faso            
##  [203] Burkina Faso             Burkina Faso            
##  [205] Burundi                  Burundi                 
##  [207] Burundi                  Burundi                 
##  [209] Burundi                  Burundi                 
##  [211] Burundi                  Burundi                 
##  [213] Burundi                  Burundi                 
##  [215] Burundi                  Burundi                 
##  [217] Cambodia                 Cambodia                
##  [219] Cambodia                 Cambodia                
##  [221] Cambodia                 Cambodia                
##  [223] Cambodia                 Cambodia                
##  [225] Cambodia                 Cambodia                
##  [227] Cambodia                 Cambodia                
##  [229] Cameroon                 Cameroon                
##  [231] Cameroon                 Cameroon                
##  [233] Cameroon                 Cameroon                
##  [235] Cameroon                 Cameroon                
##  [237] Cameroon                 Cameroon                
##  [239] Cameroon                 Cameroon                
##  [241] Canada                   Canada                  
##  [243] Canada                   Canada                  
##  [245] Canada                   Canada                  
##  [247] Canada                   Canada                  
##  [249] Canada                   Canada                  
##  [251] Canada                   Canada                  
##  [253] Central African Republic Central African Republic
##  [255] Central African Republic Central African Republic
##  [257] Central African Republic Central African Republic
##  [259] Central African Republic Central African Republic
##  [261] Central African Republic Central African Republic
##  [263] Central African Republic Central African Republic
##  [265] Chad                     Chad                    
##  [267] Chad                     Chad                    
##  [269] Chad                     Chad                    
##  [271] Chad                     Chad                    
##  [273] Chad                     Chad                    
##  [275] Chad                     Chad                    
##  [277] Chile                    Chile                   
##  [279] Chile                    Chile                   
##  [281] Chile                    Chile                   
##  [283] Chile                    Chile                   
##  [285] Chile                    Chile                   
##  [287] Chile                    Chile                   
##  [289] China                    China                   
##  [291] China                    China                   
##  [293] China                    China                   
##  [295] China                    China                   
##  [297] China                    China                   
##  [299] China                    China                   
##  [301] Colombia                 Colombia                
##  [303] Colombia                 Colombia                
##  [305] Colombia                 Colombia                
##  [307] Colombia                 Colombia                
##  [309] Colombia                 Colombia                
##  [311] Colombia                 Colombia                
##  [313] Comoros                  Comoros                 
##  [315] Comoros                  Comoros                 
##  [317] Comoros                  Comoros                 
##  [319] Comoros                  Comoros                 
##  [321] Comoros                  Comoros                 
##  [323] Comoros                  Comoros                 
##  [325] Congo, Dem. Rep.         Congo, Dem. Rep.        
##  [327] Congo, Dem. Rep.         Congo, Dem. Rep.        
##  [329] Congo, Dem. Rep.         Congo, Dem. Rep.        
##  [331] Congo, Dem. Rep.         Congo, Dem. Rep.        
##  [333] Congo, Dem. Rep.         Congo, Dem. Rep.        
##  [335] Congo, Dem. Rep.         Congo, Dem. Rep.        
##  [337] Congo, Rep.              Congo, Rep.             
##  [339] Congo, Rep.              Congo, Rep.             
##  [341] Congo, Rep.              Congo, Rep.             
##  [343] Congo, Rep.              Congo, Rep.             
##  [345] Congo, Rep.              Congo, Rep.             
##  [347] Congo, Rep.              Congo, Rep.             
##  [349] Costa Rica               Costa Rica              
##  [351] Costa Rica               Costa Rica              
##  [353] Costa Rica               Costa Rica              
##  [355] Costa Rica               Costa Rica              
##  [357] Costa Rica               Costa Rica              
##  [359] Costa Rica               Costa Rica              
##  [361] Cote d'Ivoire            Cote d'Ivoire           
##  [363] Cote d'Ivoire            Cote d'Ivoire           
##  [365] Cote d'Ivoire            Cote d'Ivoire           
##  [367] Cote d'Ivoire            Cote d'Ivoire           
##  [369] Cote d'Ivoire            Cote d'Ivoire           
##  [371] Cote d'Ivoire            Cote d'Ivoire           
##  [373] Croatia                  Croatia                 
##  [375] Croatia                  Croatia                 
##  [377] Croatia                  Croatia                 
##  [379] Croatia                  Croatia                 
##  [381] Croatia                  Croatia                 
##  [383] Croatia                  Croatia                 
##  [385] Cuba                     Cuba                    
##  [387] Cuba                     Cuba                    
##  [389] Cuba                     Cuba                    
##  [391] Cuba                     Cuba                    
##  [393] Cuba                     Cuba                    
##  [395] Cuba                     Cuba                    
##  [397] Czech Republic           Czech Republic          
##  [399] Czech Republic           Czech Republic          
##  [401] Czech Republic           Czech Republic          
##  [403] Czech Republic           Czech Republic          
##  [405] Czech Republic           Czech Republic          
##  [407] Czech Republic           Czech Republic          
##  [409] Denmark                  Denmark                 
##  [411] Denmark                  Denmark                 
##  [413] Denmark                  Denmark                 
##  [415] Denmark                  Denmark                 
##  [417] Denmark                  Denmark                 
##  [419] Denmark                  Denmark                 
##  [421] Djibouti                 Djibouti                
##  [423] Djibouti                 Djibouti                
##  [425] Djibouti                 Djibouti                
##  [427] Djibouti                 Djibouti                
##  [429] Djibouti                 Djibouti                
##  [431] Djibouti                 Djibouti                
##  [433] Dominican Republic       Dominican Republic      
##  [435] Dominican Republic       Dominican Republic      
##  [437] Dominican Republic       Dominican Republic      
##  [439] Dominican Republic       Dominican Republic      
##  [441] Dominican Republic       Dominican Republic      
##  [443] Dominican Republic       Dominican Republic      
##  [445] Ecuador                  Ecuador                 
##  [447] Ecuador                  Ecuador                 
##  [449] Ecuador                  Ecuador                 
##  [451] Ecuador                  Ecuador                 
##  [453] Ecuador                  Ecuador                 
##  [455] Ecuador                  Ecuador                 
##  [457] Egypt                    Egypt                   
##  [459] Egypt                    Egypt                   
##  [461] Egypt                    Egypt                   
##  [463] Egypt                    Egypt                   
##  [465] Egypt                    Egypt                   
##  [467] Egypt                    Egypt                   
##  [469] El Salvador              El Salvador             
##  [471] El Salvador              El Salvador             
##  [473] El Salvador              El Salvador             
##  [475] El Salvador              El Salvador             
##  [477] El Salvador              El Salvador             
##  [479] El Salvador              El Salvador             
##  [481] Equatorial Guinea        Equatorial Guinea       
##  [483] Equatorial Guinea        Equatorial Guinea       
##  [485] Equatorial Guinea        Equatorial Guinea       
##  [487] Equatorial Guinea        Equatorial Guinea       
##  [489] Equatorial Guinea        Equatorial Guinea       
##  [491] Equatorial Guinea        Equatorial Guinea       
##  [493] Eritrea                  Eritrea                 
##  [495] Eritrea                  Eritrea                 
##  [497] Eritrea                  Eritrea                 
##  [499] Eritrea                  Eritrea                 
##  [501] Eritrea                  Eritrea                 
##  [503] Eritrea                  Eritrea                 
##  [505] Ethiopia                 Ethiopia                
##  [507] Ethiopia                 Ethiopia                
##  [509] Ethiopia                 Ethiopia                
##  [511] Ethiopia                 Ethiopia                
##  [513] Ethiopia                 Ethiopia                
##  [515] Ethiopia                 Ethiopia                
##  [517] Finland                  Finland                 
##  [519] Finland                  Finland                 
##  [521] Finland                  Finland                 
##  [523] Finland                  Finland                 
##  [525] Finland                  Finland                 
##  [527] Finland                  Finland                 
##  [529] France                   France                  
##  [531] France                   France                  
##  [533] France                   France                  
##  [535] France                   France                  
##  [537] France                   France                  
##  [539] France                   France                  
##  [541] Gabon                    Gabon                   
##  [543] Gabon                    Gabon                   
##  [545] Gabon                    Gabon                   
##  [547] Gabon                    Gabon                   
##  [549] Gabon                    Gabon                   
##  [551] Gabon                    Gabon                   
##  [553] Gambia                   Gambia                  
##  [555] Gambia                   Gambia                  
##  [557] Gambia                   Gambia                  
##  [559] Gambia                   Gambia                  
##  [561] Gambia                   Gambia                  
##  [563] Gambia                   Gambia                  
##  [565] Germany                  Germany                 
##  [567] Germany                  Germany                 
##  [569] Germany                  Germany                 
##  [571] Germany                  Germany                 
##  [573] Germany                  Germany                 
##  [575] Germany                  Germany                 
##  [577] Ghana                    Ghana                   
##  [579] Ghana                    Ghana                   
##  [581] Ghana                    Ghana                   
##  [583] Ghana                    Ghana                   
##  [585] Ghana                    Ghana                   
##  [587] Ghana                    Ghana                   
##  [589] Greece                   Greece                  
##  [591] Greece                   Greece                  
##  [593] Greece                   Greece                  
##  [595] Greece                   Greece                  
##  [597] Greece                   Greece                  
##  [599] Greece                   Greece                  
##  [601] Guatemala                Guatemala               
##  [603] Guatemala                Guatemala               
##  [605] Guatemala                Guatemala               
##  [607] Guatemala                Guatemala               
##  [609] Guatemala                Guatemala               
##  [611] Guatemala                Guatemala               
##  [613] Guinea                   Guinea                  
##  [615] Guinea                   Guinea                  
##  [617] Guinea                   Guinea                  
##  [619] Guinea                   Guinea                  
##  [621] Guinea                   Guinea                  
##  [623] Guinea                   Guinea                  
##  [625] Guinea-Bissau            Guinea-Bissau           
##  [627] Guinea-Bissau            Guinea-Bissau           
##  [629] Guinea-Bissau            Guinea-Bissau           
##  [631] Guinea-Bissau            Guinea-Bissau           
##  [633] Guinea-Bissau            Guinea-Bissau           
##  [635] Guinea-Bissau            Guinea-Bissau           
##  [637] Haiti                    Haiti                   
##  [639] Haiti                    Haiti                   
##  [641] Haiti                    Haiti                   
##  [643] Haiti                    Haiti                   
##  [645] Haiti                    Haiti                   
##  [647] Haiti                    Haiti                   
##  [649] Honduras                 Honduras                
##  [651] Honduras                 Honduras                
##  [653] Honduras                 Honduras                
##  [655] Honduras                 Honduras                
##  [657] Honduras                 Honduras                
##  [659] Honduras                 Honduras                
##  [661] Hong Kong, China         Hong Kong, China        
##  [663] Hong Kong, China         Hong Kong, China        
##  [665] Hong Kong, China         Hong Kong, China        
##  [667] Hong Kong, China         Hong Kong, China        
##  [669] Hong Kong, China         Hong Kong, China        
##  [671] Hong Kong, China         Hong Kong, China        
##  [673] Hungary                  Hungary                 
##  [675] Hungary                  Hungary                 
##  [677] Hungary                  Hungary                 
##  [679] Hungary                  Hungary                 
##  [681] Hungary                  Hungary                 
##  [683] Hungary                  Hungary                 
##  [685] Iceland                  Iceland                 
##  [687] Iceland                  Iceland                 
##  [689] Iceland                  Iceland                 
##  [691] Iceland                  Iceland                 
##  [693] Iceland                  Iceland                 
##  [695] Iceland                  Iceland                 
##  [697] India                    India                   
##  [699] India                    India                   
##  [701] India                    India                   
##  [703] India                    India                   
##  [705] India                    India                   
##  [707] India                    India                   
##  [709] Indonesia                Indonesia               
##  [711] Indonesia                Indonesia               
##  [713] Indonesia                Indonesia               
##  [715] Indonesia                Indonesia               
##  [717] Indonesia                Indonesia               
##  [719] Indonesia                Indonesia               
##  [721] Iran                     Iran                    
##  [723] Iran                     Iran                    
##  [725] Iran                     Iran                    
##  [727] Iran                     Iran                    
##  [729] Iran                     Iran                    
##  [731] Iran                     Iran                    
##  [733] Iraq                     Iraq                    
##  [735] Iraq                     Iraq                    
##  [737] Iraq                     Iraq                    
##  [739] Iraq                     Iraq                    
##  [741] Iraq                     Iraq                    
##  [743] Iraq                     Iraq                    
##  [745] Ireland                  Ireland                 
##  [747] Ireland                  Ireland                 
##  [749] Ireland                  Ireland                 
##  [751] Ireland                  Ireland                 
##  [753] Ireland                  Ireland                 
##  [755] Ireland                  Ireland                 
##  [757] Israel                   Israel                  
##  [759] Israel                   Israel                  
##  [761] Israel                   Israel                  
##  [763] Israel                   Israel                  
##  [765] Israel                   Israel                  
##  [767] Israel                   Israel                  
##  [769] Italy                    Italy                   
##  [771] Italy                    Italy                   
##  [773] Italy                    Italy                   
##  [775] Italy                    Italy                   
##  [777] Italy                    Italy                   
##  [779] Italy                    Italy                   
##  [781] Jamaica                  Jamaica                 
##  [783] Jamaica                  Jamaica                 
##  [785] Jamaica                  Jamaica                 
##  [787] Jamaica                  Jamaica                 
##  [789] Jamaica                  Jamaica                 
##  [791] Jamaica                  Jamaica                 
##  [793] Japan                    Japan                   
##  [795] Japan                    Japan                   
##  [797] Japan                    Japan                   
##  [799] Japan                    Japan                   
##  [801] Japan                    Japan                   
##  [803] Japan                    Japan                   
##  [805] Jordan                   Jordan                  
##  [807] Jordan                   Jordan                  
##  [809] Jordan                   Jordan                  
##  [811] Jordan                   Jordan                  
##  [813] Jordan                   Jordan                  
##  [815] Jordan                   Jordan                  
##  [817] Kenya                    Kenya                   
##  [819] Kenya                    Kenya                   
##  [821] Kenya                    Kenya                   
##  [823] Kenya                    Kenya                   
##  [825] Kenya                    Kenya                   
##  [827] Kenya                    Kenya                   
##  [829] Korea, Dem. Rep.         Korea, Dem. Rep.        
##  [831] Korea, Dem. Rep.         Korea, Dem. Rep.        
##  [833] Korea, Dem. Rep.         Korea, Dem. Rep.        
##  [835] Korea, Dem. Rep.         Korea, Dem. Rep.        
##  [837] Korea, Dem. Rep.         Korea, Dem. Rep.        
##  [839] Korea, Dem. Rep.         Korea, Dem. Rep.        
##  [841] Korea, Rep.              Korea, Rep.             
##  [843] Korea, Rep.              Korea, Rep.             
##  [845] Korea, Rep.              Korea, Rep.             
##  [847] Korea, Rep.              Korea, Rep.             
##  [849] Korea, Rep.              Korea, Rep.             
##  [851] Korea, Rep.              Korea, Rep.             
##  [853] Kuwait                   Kuwait                  
##  [855] Kuwait                   Kuwait                  
##  [857] Kuwait                   Kuwait                  
##  [859] Kuwait                   Kuwait                  
##  [861] Kuwait                   Kuwait                  
##  [863] Kuwait                   Kuwait                  
##  [865] Lebanon                  Lebanon                 
##  [867] Lebanon                  Lebanon                 
##  [869] Lebanon                  Lebanon                 
##  [871] Lebanon                  Lebanon                 
##  [873] Lebanon                  Lebanon                 
##  [875] Lebanon                  Lebanon                 
##  [877] Lesotho                  Lesotho                 
##  [879] Lesotho                  Lesotho                 
##  [881] Lesotho                  Lesotho                 
##  [883] Lesotho                  Lesotho                 
##  [885] Lesotho                  Lesotho                 
##  [887] Lesotho                  Lesotho                 
##  [889] Liberia                  Liberia                 
##  [891] Liberia                  Liberia                 
##  [893] Liberia                  Liberia                 
##  [895] Liberia                  Liberia                 
##  [897] Liberia                  Liberia                 
##  [899] Liberia                  Liberia                 
##  [901] Libya                    Libya                   
##  [903] Libya                    Libya                   
##  [905] Libya                    Libya                   
##  [907] Libya                    Libya                   
##  [909] Libya                    Libya                   
##  [911] Libya                    Libya                   
##  [913] Madagascar               Madagascar              
##  [915] Madagascar               Madagascar              
##  [917] Madagascar               Madagascar              
##  [919] Madagascar               Madagascar              
##  [921] Madagascar               Madagascar              
##  [923] Madagascar               Madagascar              
##  [925] Malawi                   Malawi                  
##  [927] Malawi                   Malawi                  
##  [929] Malawi                   Malawi                  
##  [931] Malawi                   Malawi                  
##  [933] Malawi                   Malawi                  
##  [935] Malawi                   Malawi                  
##  [937] Malaysia                 Malaysia                
##  [939] Malaysia                 Malaysia                
##  [941] Malaysia                 Malaysia                
##  [943] Malaysia                 Malaysia                
##  [945] Malaysia                 Malaysia                
##  [947] Malaysia                 Malaysia                
##  [949] Mali                     Mali                    
##  [951] Mali                     Mali                    
##  [953] Mali                     Mali                    
##  [955] Mali                     Mali                    
##  [957] Mali                     Mali                    
##  [959] Mali                     Mali                    
##  [961] Mauritania               Mauritania              
##  [963] Mauritania               Mauritania              
##  [965] Mauritania               Mauritania              
##  [967] Mauritania               Mauritania              
##  [969] Mauritania               Mauritania              
##  [971] Mauritania               Mauritania              
##  [973] Mauritius                Mauritius               
##  [975] Mauritius                Mauritius               
##  [977] Mauritius                Mauritius               
##  [979] Mauritius                Mauritius               
##  [981] Mauritius                Mauritius               
##  [983] Mauritius                Mauritius               
##  [985] Mexico                   Mexico                  
##  [987] Mexico                   Mexico                  
##  [989] Mexico                   Mexico                  
##  [991] Mexico                   Mexico                  
##  [993] Mexico                   Mexico                  
##  [995] Mexico                   Mexico                  
##  [997] Mongolia                 Mongolia                
##  [999] Mongolia                 Mongolia                
## [1001] Mongolia                 Mongolia                
## [1003] Mongolia                 Mongolia                
## [1005] Mongolia                 Mongolia                
## [1007] Mongolia                 Mongolia                
## [1009] Montenegro               Montenegro              
## [1011] Montenegro               Montenegro              
## [1013] Montenegro               Montenegro              
## [1015] Montenegro               Montenegro              
## [1017] Montenegro               Montenegro              
## [1019] Montenegro               Montenegro              
## [1021] Morocco                  Morocco                 
## [1023] Morocco                  Morocco                 
## [1025] Morocco                  Morocco                 
## [1027] Morocco                  Morocco                 
## [1029] Morocco                  Morocco                 
## [1031] Morocco                  Morocco                 
## [1033] Mozambique               Mozambique              
## [1035] Mozambique               Mozambique              
## [1037] Mozambique               Mozambique              
## [1039] Mozambique               Mozambique              
## [1041] Mozambique               Mozambique              
## [1043] Mozambique               Mozambique              
## [1045] Myanmar                  Myanmar                 
## [1047] Myanmar                  Myanmar                 
## [1049] Myanmar                  Myanmar                 
## [1051] Myanmar                  Myanmar                 
## [1053] Myanmar                  Myanmar                 
## [1055] Myanmar                  Myanmar                 
## [1057] Namibia                  Namibia                 
## [1059] Namibia                  Namibia                 
## [1061] Namibia                  Namibia                 
## [1063] Namibia                  Namibia                 
## [1065] Namibia                  Namibia                 
## [1067] Namibia                  Namibia                 
## [1069] Nepal                    Nepal                   
## [1071] Nepal                    Nepal                   
## [1073] Nepal                    Nepal                   
## [1075] Nepal                    Nepal                   
## [1077] Nepal                    Nepal                   
## [1079] Nepal                    Nepal                   
## [1081] Netherlands              Netherlands             
## [1083] Netherlands              Netherlands             
## [1085] Netherlands              Netherlands             
## [1087] Netherlands              Netherlands             
## [1089] Netherlands              Netherlands             
## [1091] Netherlands              Netherlands             
## [1093] New Zealand              New Zealand             
## [1095] New Zealand              New Zealand             
## [1097] New Zealand              New Zealand             
## [1099] New Zealand              New Zealand             
## [1101] New Zealand              New Zealand             
## [1103] New Zealand              New Zealand             
## [1105] Nicaragua                Nicaragua               
## [1107] Nicaragua                Nicaragua               
## [1109] Nicaragua                Nicaragua               
## [1111] Nicaragua                Nicaragua               
## [1113] Nicaragua                Nicaragua               
## [1115] Nicaragua                Nicaragua               
## [1117] Niger                    Niger                   
## [1119] Niger                    Niger                   
## [1121] Niger                    Niger                   
## [1123] Niger                    Niger                   
## [1125] Niger                    Niger                   
## [1127] Niger                    Niger                   
## [1129] Nigeria                  Nigeria                 
## [1131] Nigeria                  Nigeria                 
## [1133] Nigeria                  Nigeria                 
## [1135] Nigeria                  Nigeria                 
## [1137] Nigeria                  Nigeria                 
## [1139] Nigeria                  Nigeria                 
## [1141] Norway                   Norway                  
## [1143] Norway                   Norway                  
## [1145] Norway                   Norway                  
## [1147] Norway                   Norway                  
## [1149] Norway                   Norway                  
## [1151] Norway                   Norway                  
## [1153] Oman                     Oman                    
## [1155] Oman                     Oman                    
## [1157] Oman                     Oman                    
## [1159] Oman                     Oman                    
## [1161] Oman                     Oman                    
## [1163] Oman                     Oman                    
## [1165] Pakistan                 Pakistan                
## [1167] Pakistan                 Pakistan                
## [1169] Pakistan                 Pakistan                
## [1171] Pakistan                 Pakistan                
## [1173] Pakistan                 Pakistan                
## [1175] Pakistan                 Pakistan                
## [1177] Panama                   Panama                  
## [1179] Panama                   Panama                  
## [1181] Panama                   Panama                  
## [1183] Panama                   Panama                  
## [1185] Panama                   Panama                  
## [1187] Panama                   Panama                  
## [1189] Paraguay                 Paraguay                
## [1191] Paraguay                 Paraguay                
## [1193] Paraguay                 Paraguay                
## [1195] Paraguay                 Paraguay                
## [1197] Paraguay                 Paraguay                
## [1199] Paraguay                 Paraguay                
## [1201] Peru                     Peru                    
## [1203] Peru                     Peru                    
## [1205] Peru                     Peru                    
## [1207] Peru                     Peru                    
## [1209] Peru                     Peru                    
## [1211] Peru                     Peru                    
## [1213] Philippines              Philippines             
## [1215] Philippines              Philippines             
## [1217] Philippines              Philippines             
## [1219] Philippines              Philippines             
## [1221] Philippines              Philippines             
## [1223] Philippines              Philippines             
## [1225] Poland                   Poland                  
## [1227] Poland                   Poland                  
## [1229] Poland                   Poland                  
## [1231] Poland                   Poland                  
## [1233] Poland                   Poland                  
## [1235] Poland                   Poland                  
## [1237] Portugal                 Portugal                
## [1239] Portugal                 Portugal                
## [1241] Portugal                 Portugal                
## [1243] Portugal                 Portugal                
## [1245] Portugal                 Portugal                
## [1247] Portugal                 Portugal                
## [1249] Puerto Rico              Puerto Rico             
## [1251] Puerto Rico              Puerto Rico             
## [1253] Puerto Rico              Puerto Rico             
## [1255] Puerto Rico              Puerto Rico             
## [1257] Puerto Rico              Puerto Rico             
## [1259] Puerto Rico              Puerto Rico             
## [1261] Reunion                  Reunion                 
## [1263] Reunion                  Reunion                 
## [1265] Reunion                  Reunion                 
## [1267] Reunion                  Reunion                 
## [1269] Reunion                  Reunion                 
## [1271] Reunion                  Reunion                 
## [1273] Romania                  Romania                 
## [1275] Romania                  Romania                 
## [1277] Romania                  Romania                 
## [1279] Romania                  Romania                 
## [1281] Romania                  Romania                 
## [1283] Romania                  Romania                 
## [1285] Rwanda                   Rwanda                  
## [1287] Rwanda                   Rwanda                  
## [1289] Rwanda                   Rwanda                  
## [1291] Rwanda                   Rwanda                  
## [1293] Rwanda                   Rwanda                  
## [1295] Rwanda                   Rwanda                  
## [1297] Sao Tome and Principe    Sao Tome and Principe   
## [1299] Sao Tome and Principe    Sao Tome and Principe   
## [1301] Sao Tome and Principe    Sao Tome and Principe   
## [1303] Sao Tome and Principe    Sao Tome and Principe   
## [1305] Sao Tome and Principe    Sao Tome and Principe   
## [1307] Sao Tome and Principe    Sao Tome and Principe   
## [1309] Saudi Arabia             Saudi Arabia            
## [1311] Saudi Arabia             Saudi Arabia            
## [1313] Saudi Arabia             Saudi Arabia            
## [1315] Saudi Arabia             Saudi Arabia            
## [1317] Saudi Arabia             Saudi Arabia            
## [1319] Saudi Arabia             Saudi Arabia            
## [1321] Senegal                  Senegal                 
## [1323] Senegal                  Senegal                 
## [1325] Senegal                  Senegal                 
## [1327] Senegal                  Senegal                 
## [1329] Senegal                  Senegal                 
## [1331] Senegal                  Senegal                 
## [1333] Serbia                   Serbia                  
## [1335] Serbia                   Serbia                  
## [1337] Serbia                   Serbia                  
## [1339] Serbia                   Serbia                  
## [1341] Serbia                   Serbia                  
## [1343] Serbia                   Serbia                  
## [1345] Sierra Leone             Sierra Leone            
## [1347] Sierra Leone             Sierra Leone            
## [1349] Sierra Leone             Sierra Leone            
## [1351] Sierra Leone             Sierra Leone            
## [1353] Sierra Leone             Sierra Leone            
## [1355] Sierra Leone             Sierra Leone            
## [1357] Singapore                Singapore               
## [1359] Singapore                Singapore               
## [1361] Singapore                Singapore               
## [1363] Singapore                Singapore               
## [1365] Singapore                Singapore               
## [1367] Singapore                Singapore               
## [1369] Slovak Republic          Slovak Republic         
## [1371] Slovak Republic          Slovak Republic         
## [1373] Slovak Republic          Slovak Republic         
## [1375] Slovak Republic          Slovak Republic         
## [1377] Slovak Republic          Slovak Republic         
## [1379] Slovak Republic          Slovak Republic         
## [1381] Slovenia                 Slovenia                
## [1383] Slovenia                 Slovenia                
## [1385] Slovenia                 Slovenia                
## [1387] Slovenia                 Slovenia                
## [1389] Slovenia                 Slovenia                
## [1391] Slovenia                 Slovenia                
## [1393] Somalia                  Somalia                 
## [1395] Somalia                  Somalia                 
## [1397] Somalia                  Somalia                 
## [1399] Somalia                  Somalia                 
## [1401] Somalia                  Somalia                 
## [1403] Somalia                  Somalia                 
## [1405] South Africa             South Africa            
## [1407] South Africa             South Africa            
## [1409] South Africa             South Africa            
## [1411] South Africa             South Africa            
## [1413] South Africa             South Africa            
## [1415] South Africa             South Africa            
## [1417] Spain                    Spain                   
## [1419] Spain                    Spain                   
## [1421] Spain                    Spain                   
## [1423] Spain                    Spain                   
## [1425] Spain                    Spain                   
## [1427] Spain                    Spain                   
## [1429] Sri Lanka                Sri Lanka               
## [1431] Sri Lanka                Sri Lanka               
## [1433] Sri Lanka                Sri Lanka               
## [1435] Sri Lanka                Sri Lanka               
## [1437] Sri Lanka                Sri Lanka               
## [1439] Sri Lanka                Sri Lanka               
## [1441] Sudan                    Sudan                   
## [1443] Sudan                    Sudan                   
## [1445] Sudan                    Sudan                   
## [1447] Sudan                    Sudan                   
## [1449] Sudan                    Sudan                   
## [1451] Sudan                    Sudan                   
## [1453] Swaziland                Swaziland               
## [1455] Swaziland                Swaziland               
## [1457] Swaziland                Swaziland               
## [1459] Swaziland                Swaziland               
## [1461] Swaziland                Swaziland               
## [1463] Swaziland                Swaziland               
## [1465] Sweden                   Sweden                  
## [1467] Sweden                   Sweden                  
## [1469] Sweden                   Sweden                  
## [1471] Sweden                   Sweden                  
## [1473] Sweden                   Sweden                  
## [1475] Sweden                   Sweden                  
## [1477] Switzerland              Switzerland             
## [1479] Switzerland              Switzerland             
## [1481] Switzerland              Switzerland             
## [1483] Switzerland              Switzerland             
## [1485] Switzerland              Switzerland             
## [1487] Switzerland              Switzerland             
## [1489] Syria                    Syria                   
## [1491] Syria                    Syria                   
## [1493] Syria                    Syria                   
## [1495] Syria                    Syria                   
## [1497] Syria                    Syria                   
## [1499] Syria                    Syria                   
## [1501] Taiwan                   Taiwan                  
## [1503] Taiwan                   Taiwan                  
## [1505] Taiwan                   Taiwan                  
## [1507] Taiwan                   Taiwan                  
## [1509] Taiwan                   Taiwan                  
## [1511] Taiwan                   Taiwan                  
## [1513] Tanzania                 Tanzania                
## [1515] Tanzania                 Tanzania                
## [1517] Tanzania                 Tanzania                
## [1519] Tanzania                 Tanzania                
## [1521] Tanzania                 Tanzania                
## [1523] Tanzania                 Tanzania                
## [1525] Thailand                 Thailand                
## [1527] Thailand                 Thailand                
## [1529] Thailand                 Thailand                
## [1531] Thailand                 Thailand                
## [1533] Thailand                 Thailand                
## [1535] Thailand                 Thailand                
## [1537] Togo                     Togo                    
## [1539] Togo                     Togo                    
## [1541] Togo                     Togo                    
## [1543] Togo                     Togo                    
## [1545] Togo                     Togo                    
## [1547] Togo                     Togo                    
## [1549] Trinidad and Tobago      Trinidad and Tobago     
## [1551] Trinidad and Tobago      Trinidad and Tobago     
## [1553] Trinidad and Tobago      Trinidad and Tobago     
## [1555] Trinidad and Tobago      Trinidad and Tobago     
## [1557] Trinidad and Tobago      Trinidad and Tobago     
## [1559] Trinidad and Tobago      Trinidad and Tobago     
## [1561] Tunisia                  Tunisia                 
## [1563] Tunisia                  Tunisia                 
## [1565] Tunisia                  Tunisia                 
## [1567] Tunisia                  Tunisia                 
## [1569] Tunisia                  Tunisia                 
## [1571] Tunisia                  Tunisia                 
## [1573] Turkey                   Turkey                  
## [1575] Turkey                   Turkey                  
## [1577] Turkey                   Turkey                  
## [1579] Turkey                   Turkey                  
## [1581] Turkey                   Turkey                  
## [1583] Turkey                   Turkey                  
## [1585] Uganda                   Uganda                  
## [1587] Uganda                   Uganda                  
## [1589] Uganda                   Uganda                  
## [1591] Uganda                   Uganda                  
## [1593] Uganda                   Uganda                  
## [1595] Uganda                   Uganda                  
## [1597] United Kingdom           United Kingdom          
## [1599] United Kingdom           United Kingdom          
## [1601] United Kingdom           United Kingdom          
## [1603] United Kingdom           United Kingdom          
## [1605] United Kingdom           United Kingdom          
## [1607] United Kingdom           United Kingdom          
## [1609] United States            United States           
## [1611] United States            United States           
## [1613] United States            United States           
## [1615] United States            United States           
## [1617] United States            United States           
## [1619] United States            United States           
## [1621] Uruguay                  Uruguay                 
## [1623] Uruguay                  Uruguay                 
## [1625] Uruguay                  Uruguay                 
## [1627] Uruguay                  Uruguay                 
## [1629] Uruguay                  Uruguay                 
## [1631] Uruguay                  Uruguay                 
## [1633] Venezuela                Venezuela               
## [1635] Venezuela                Venezuela               
## [1637] Venezuela                Venezuela               
## [1639] Venezuela                Venezuela               
## [1641] Venezuela                Venezuela               
## [1643] Venezuela                Venezuela               
## [1645] Vietnam                  Vietnam                 
## [1647] Vietnam                  Vietnam                 
## [1649] Vietnam                  Vietnam                 
## [1651] Vietnam                  Vietnam                 
## [1653] Vietnam                  Vietnam                 
## [1655] Vietnam                  Vietnam                 
## [1657] West Bank and Gaza       West Bank and Gaza      
## [1659] West Bank and Gaza       West Bank and Gaza      
## [1661] West Bank and Gaza       West Bank and Gaza      
## [1663] West Bank and Gaza       West Bank and Gaza      
## [1665] West Bank and Gaza       West Bank and Gaza      
## [1667] West Bank and Gaza       West Bank and Gaza      
## [1669] Yemen, Rep.              Yemen, Rep.             
## [1671] Yemen, Rep.              Yemen, Rep.             
## [1673] Yemen, Rep.              Yemen, Rep.             
## [1675] Yemen, Rep.              Yemen, Rep.             
## [1677] Yemen, Rep.              Yemen, Rep.             
## [1679] Yemen, Rep.              Yemen, Rep.             
## [1681] Zambia                   Zambia                  
## [1683] Zambia                   Zambia                  
## [1685] Zambia                   Zambia                  
## [1687] Zambia                   Zambia                  
## [1689] Zambia                   Zambia                  
## [1691] Zambia                   Zambia                  
## [1693] Zimbabwe                 Zimbabwe                
## [1695] Zimbabwe                 Zimbabwe                
## [1697] Zimbabwe                 Zimbabwe                
## [1699] Zimbabwe                 Zimbabwe                
## [1701] Zimbabwe                 Zimbabwe                
## [1703] Zimbabwe                 Zimbabwe                
## 142 Levels: Afghanistan Albania Algeria Angola Argentina Australia ... Zimbabwe
attach(gapminder)  #
pop
##    [1]    8425333    9240934   10267083   11537966   13079460   14880372
##    [7]   12881816   13867957   16317921   22227415   25268405   31889923
##   [13]    1282697    1476505    1728137    1984060    2263554    2509048
##   [19]    2780097    3075321    3326498    3428038    3508512    3600523
##   [25]    9279525   10270856   11000948   12760499   14760787   17152804
##   [31]   20033753   23254956   26298373   29072015   31287142   33333216
##   [37]    4232095    4561361    4826015    5247469    5894858    6162675
##   [43]    7016384    7874230    8735988    9875024   10866106   12420476
##   [49]   17876956   19610538   21283783   22934225   24779799   26983828
##   [55]   29341374   31620918   33958947   36203463   38331121   40301927
##   [61]    8691212    9712569   10794968   11872264   13177000   14074100
##   [67]   15184200   16257249   17481977   18565243   19546792   20434176
##   [73]    6927772    6965860    7129864    7376998    7544201    7568430
##   [79]    7574613    7578903    7914969    8069876    8148312    8199783
##   [85]     120447     138655     171863     202182     230800     297410
##   [91]     377967     454612     529491     598561     656397     708573
##   [97]   46886859   51365468   56839289   62821884   70759295   80428306
##  [103]   93074406  103764241  113704579  123315288  135656790  150448339
##  [109]    8730405    8989111    9218400    9556500    9709100    9821800
##  [115]    9856303    9870200   10045622   10199787   10311970   10392226
##  [121]    1738315    1925173    2151895    2427334    2761407    3168267
##  [127]    3641603    4243788    4981671    6066080    7026113    8078314
##  [133]    2883315    3211738    3593918    4040665    4565872    5079716
##  [139]    5642224    6156369    6893451    7693188    8445134    9119152
##  [145]    2791000    3076000    3349000    3585000    3819000    4086000
##  [151]    4172693    4338977    4256013    3607000    4165416    4552198
##  [157]     442308     474639     512764     553541     619351     781472
##  [163]     970347    1151184    1342614    1536536    1630347    1639131
##  [169]   56602560   65551171   76039390   88049823  100840058  114313951
##  [175]  128962939  142938076  155975974  168546719  179914212  190010647
##  [181]    7274900    7651254    8012946    8310226    8576200    8797022
##  [187]    8892098    8971958    8658506    8066057    7661799    7322858
##  [193]    4469979    4713416    4919632    5127935    5433886    5889574
##  [199]    6634596    7586551    8878303   10352843   12251209   14326203
##  [205]    2445618    2667518    2961915    3330989    3529983    3834415
##  [211]    4580410    5126023    5809236    6121610    7021078    8390505
##  [217]    4693836    5322536    6083619    6960067    7450606    6978607
##  [223]    7272485    8371791   10150094   11782962   12926707   14131858
##  [229]    5009067    5359923    5793633    6335506    7021028    7959865
##  [235]    9250831   10780667   12467171   14195809   15929988   17696293
##  [241]   14785584   17010154   18985849   20819767   22284500   23796400
##  [247]   25201900   26549700   28523502   30305843   31902268   33390141
##  [253]    1291695    1392284    1523478    1733638    1927260    2167533
##  [259]    2476971    2840009    3265124    3696513    4048013    4369038
##  [265]    2682462    2894855    3150417    3495967    3899068    4388260
##  [271]    4875118    5498955    6429417    7562011    8835739   10238807
##  [277]    6377619    7048426    7961258    8858908    9717524   10599793
##  [283]   11487112   12463354   13572994   14599929   15497046   16284741
##  [289]  556263527  637408000  665770000  754550000  862030000  943455000
##  [295] 1000281000 1084035000 1164970000 1230075000 1280400000 1318683096
##  [301]   12350771   14485993   17009885   19764027   22542890   25094412
##  [307]   27764644   30964245   34202721   37657830   41008227   44227550
##  [313]     153936     170928     191689     217378     250027     304739
##  [319]     348643     395114     454429     527982     614382     710960
##  [325]   14100005   15577932   17486434   19941073   23007669   26480870
##  [331]   30646495   35481645   41672143   47798986   55379852   64606759
##  [337]     854885     940458    1047924    1179760    1340458    1536769
##  [343]    1774735    2064095    2409073    2800947    3328795    3800610
##  [349]     926317    1112300    1345187    1588717    1834796    2108457
##  [355]    2424367    2799811    3173216    3518107    3834934    4133884
##  [361]    2977019    3300000    3832408    4744870    6071696    7459574
##  [367]    9025951   10761098   12772596   14625967   16252726   18013409
##  [373]    3882229    3991242    4076557    4174366    4225310    4318673
##  [379]    4413368    4484310    4494013    4444595    4481020    4493312
##  [385]    6007797    6640752    7254373    8139332    8831348    9537988
##  [391]    9789224   10239839   10723260   10983007   11226999   11416987
##  [397]    9125183    9513758    9620282    9835109    9862158   10161915
##  [403]   10303704   10311597   10315702   10300707   10256295   10228744
##  [409]    4334000    4487831    4646899    4838800    4991596    5088419
##  [415]    5117810    5127024    5171393    5283663    5374693    5468120
##  [421]      63149      71851      89898     127617     178848     228694
##  [427]     305991     311025     384156     417908     447416     496374
##  [433]    2491346    2923186    3453434    4049146    4671329    5302800
##  [439]    5968349    6655297    7351181    7992357    8650322    9319622
##  [445]    3548753    4058385    4681707    5432424    6298651    7278866
##  [451]    8365850    9545158   10748394   11911819   12921234   13755680
##  [457]   22223309   25009741   28173309   31681188   34807417   38783863
##  [463]   45681811   52799062   59402198   66134291   73312559   80264543
##  [469]    2042865    2355805    2747687    3232927    3790903    4282586
##  [475]    4474873    4842194    5274649    5783439    6353681    6939688
##  [481]     216964     232922     249220     259864     277603     192675
##  [487]     285483     341244     387838     439971     495627     551201
##  [493]    1438760    1542611    1666618    1820319    2260187    2512642
##  [499]    2637297    2915959    3668440    4058319    4414865    4906585
##  [505]   20860941   22815614   25145372   27860297   30770372   34617799
##  [511]   38111756   42999530   52088559   59861301   67946797   76511887
##  [517]    4090500    4324000    4491443    4605744    4639657    4738902
##  [523]    4826933    4931729    5041039    5134406    5193039    5238460
##  [529]   42459667   44310863   47124000   49569000   51732000   53165019
##  [535]   54433565   55630100   57374179   58623428   59925035   61083916
##  [541]     420702     434904     455661     489004     537977     706367
##  [547]     753874     880397     985739    1126189    1299304    1454867
##  [553]     284320     323150     374020     439593     517101     608274
##  [559]     715523     848406    1025384    1235767    1457766    1688359
##  [565]   69145952   71019069   73739117   76368453   78717088   78160773
##  [571]   78335266   77718298   80597764   82011073   82350671   82400996
##  [577]    5581001    6391288    7355248    8490213    9354120   10538093
##  [583]   11400338   14168101   16278738   18418288   20550751   22873338
##  [589]    7733250    8096218    8448233    8716441    8888628    9308479
##  [595]    9786480    9974490   10325429   10502372   10603863   10706290
##  [601]    3146381    3640876    4208858    4690773    5149581    5703430
##  [607]    6395630    7326406    8486949    9803875   11178650   12572928
##  [613]    2664249    2876726    3140003    3451418    3811387    4227026
##  [619]    4710497    5650262    6990574    8048834    8807818    9947814
##  [625]     580653     601095     627820     601287     625361     745228
##  [631]     825987     927524    1050938    1193708    1332459    1472041
##  [637]    3201488    3507701    3880130    4318137    4698301    4908554
##  [643]    5198399    5756203    6326682    6913545    7607651    8502814
##  [649]    1517453    1770390    2090162    2500689    2965146    3055235
##  [655]    3669448    4372203    5077347    5867957    6677328    7483763
##  [661]    2125900    2736300    3305200    3722800    4115700    4583700
##  [667]    5264500    5584510    5829696    6495918    6762476    6980412
##  [673]    9504000    9839000   10063000   10223422   10394091   10637171
##  [679]   10705535   10612740   10348684   10244684   10083313    9956108
##  [685]     147962     165110     182053     198676     209275     221823
##  [691]     233997     244676     259012     271192     288030     301931
##  [697]  372000000  409000000  454000000  506000000  567000000  634000000
##  [703]  708000000  788000000  872000000  959000000 1034172547 1110396331
##  [709]   82052000   90124000   99028000  109343000  121282000  136725000
##  [715]  153343000  169276000  184816000  199278000  211060000  223547000
##  [721]   17272000   19792000   22874000   26538000   30614000   35480679
##  [727]   43072751   51889696   60397973   63327987   66907826   69453570
##  [733]    5441766    6248643    7240260    8519282   10061506   11882916
##  [739]   14173318   16543189   17861905   20775703   24001816   27499638
##  [745]    2952156    2878220    2830000    2900100    3024400    3271900
##  [751]    3480000    3539900    3557761    3667233    3879155    4109086
##  [757]    1620914    1944401    2310904    2693585    3095893    3495918
##  [763]    3858421    4203148    4936550    5531387    6029529    6426679
##  [769]   47666000   49182000   50843200   52667100   54365564   56059245
##  [775]   56535636   56729703   56840847   57479469   57926999   58147733
##  [781]    1426095    1535090    1665128    1861096    1997616    2156814
##  [787]    2298309    2326606    2378618    2531311    2664659    2780132
##  [793]   86459025   91563009   95831757  100825279  107188273  113872473
##  [799]  118454974  122091325  124329269  125956499  127065841  127467972
##  [805]     607914     746559     933559    1255058    1613551    1937652
##  [811]    2347031    2820042    3867409    4526235    5307470    6053193
##  [817]    6464046    7454779    8678557   10191512   12044785   14500404
##  [823]   17661452   21198082   25020539   28263827   31386842   35610177
##  [829]    8865488    9411381   10917494   12617009   14781241   16325320
##  [835]   17647518   19067554   20711375   21585105   22215365   23301725
##  [841]   20947571   22611552   26420307   30131000   33505000   36436000
##  [847]   39326000   41622000   43805450   46173816   47969150   49044790
##  [853]     160000     212846     358266     575003     841934    1140357
##  [859]    1497494    1891487    1418095    1765345    2111561    2505559
##  [865]    1439529    1647412    1886848    2186894    2680018    3115787
##  [871]    3086876    3089353    3219994    3430388    3677780    3921278
##  [877]     748747     813338     893143     996380    1116779    1251524
##  [883]    1411807    1599200    1803195    1982823    2046772    2012649
##  [889]     863308     975950    1112796    1279406    1482628    1703617
##  [895]    1956875    2269414    1912974    2200725    2814651    3193942
##  [901]    1019729    1201578    1441863    1759224    2183877    2721783
##  [907]    3344074    3799845    4364501    4759670    5368585    6036914
##  [913]    4762912    5181679    5703324    6334556    7082430    8007166
##  [919]    9171477   10568642   12210395   14165114   16473477   19167654
##  [925]    2917802    3221238    3628608    4147252    4730997    5637246
##  [931]    6502825    7824747   10014249   10419991   11824495   13327079
##  [937]    6748378    7739235    8906385   10154878   11441462   12845381
##  [943]   14441916   16331785   18319502   20476091   22662365   24821286
##  [949]    3838168    4241884    4690372    5212416    5828158    6491649
##  [955]    6998256    7634008    8416215    9384984   10580176   12031795
##  [961]    1022556    1076852    1146757    1230542    1332786    1456688
##  [967]    1622136    1841240    2119465    2444741    2828858    3270065
##  [973]     516556     609816     701016     789309     851334     913025
##  [979]     992040    1042663    1096202    1149818    1200206    1250882
##  [985]   30144317   35015548   41121485   47995559   55984294   63759976
##  [991]   71640904   80122492   88111030   95895146  102479927  108700891
##  [997]     800663     882134    1010280    1149500    1320500    1528000
## [1003]    1756032    2015133    2312802    2494803    2674234    2874127
## [1009]     413834     442829     474528     501035     527678     560073
## [1015]     562548     569473     621621     692651     720230     684736
## [1021]    9939217   11406350   13056604   14770296   16660670   18396941
## [1027]   20198730   22987397   25798239   28529501   31167783   33757175
## [1033]    6446316    7038035    7788944    8680909    9809596   11127868
## [1039]   12587223   12891952   13160731   16603334   18473780   19951656
## [1045]   20092996   21731844   23634436   25870271   28466390   31528087
## [1051]   34680442   38028578   40546538   43247867   45598081   47761980
## [1057]     485831     548080     621392     706640     821782     977026
## [1063]    1099010    1278184    1554253    1774766    1972153    2055080
## [1069]    9182536    9682338   10332057   11261690   12412593   13933198
## [1075]   15796314   17917180   20326209   23001113   25873917   28901790
## [1081]   10381988   11026383   11805689   12596822   13329874   13852989
## [1087]   14310401   14665278   15174244   15604464   16122830   16570613
## [1093]    1994794    2229407    2488550    2728150    2929100    3164900
## [1099]    3210650    3317166    3437674    3676187    3908037    4115771
## [1105]    1165790    1358828    1590597    1865490    2182908    2554598
## [1111]    2979423    3344353    4017939    4609572    5146848    5675356
## [1117]    3379468    3692184    4076008    4534062    5060262    5682086
## [1123]    6437188    7332638    8392818    9666252   11140655   12894865
## [1129]   33119096   37173340   41871351   47287752   53740085   62209173
## [1135]   73039376   81551520   93364244  106207839  119901274  135031164
## [1141]    3327728    3491938    3638919    3786019    3933004    4043205
## [1147]    4114787    4186147    4286357    4405672    4535591    4627926
## [1153]     507833     561977     628164     714775     829050    1004533
## [1159]    1301048    1593882    1915208    2283635    2713462    3204897
## [1165]   41346560   46679944   53100671   60641899   69325921   78152686
## [1171]   91462088  105186881  120065004  135564834  153403524  169270617
## [1177]     940080    1063506    1215725    1405486    1616384    1839782
## [1183]    2036305    2253639    2484997    2734531    2990875    3242173
## [1189]    1555876    1770902    2009813    2287985    2614104    2984494
## [1195]    3366439    3886512    4483945    5154123    5884491    6667147
## [1201]    8025700    9146100   10516500   12132200   13954700   15990099
## [1207]   18125129   20195924   22430449   24748122   26769436   28674757
## [1213]   22438691   26072194   30325264   35356600   40850141   46850962
## [1219]   53456774   60017788   67185766   75012988   82995088   91077287
## [1225]   25730551   28235346   30329617   31785378   33039545   34621254
## [1231]   36227381   37740710   38370697   38654957   38625976   38518241
## [1237]    8526050    8817650    9019800    9103000    8970450    9662600
## [1243]    9859650    9915289    9927680   10156415   10433867   10642836
## [1249]    2227000    2260000    2448046    2648961    2847132    3080828
## [1255]    3279001    3444468    3585176    3759430    3859606    3942491
## [1261]     257700     308700     358900     414024     461633     492095
## [1267]     517810     562035     622191     684810     743981     798094
## [1273]   16630000   17829327   18680721   19284814   20662648   21658597
## [1279]   22356726   22686371   22797027   22562458   22404337   22276056
## [1285]    2534927    2822082    3051242    3451079    3992121    4657072
## [1291]    5507565    6349365    7290203    7212583    7852401    8860588
## [1297]      60011      61325      65345      70787      76595      86796
## [1303]      98593     110812     125911     145608     170372     199579
## [1309]    4005677    4419650    4943029    5618198    6472756    8128505
## [1315]   11254672   14619745   16945857   21229759   24501530   27601038
## [1321]    2755589    3054547    3430243    3965841    4588696    5260855
## [1327]    6147783    7171347    8307920    9535314   10870037   12267493
## [1333]    6860147    7271135    7616060    7971222    8313288    8686367
## [1339]    9032824    9230783    9826397   10336594   10111559   10150265
## [1345]    2143249    2295678    2467895    2662190    2879013    3140897
## [1351]    3464522    3868905    4260884    4578212    5359092    6144562
## [1357]    1127000    1445929    1750200    1977600    2152400    2325300
## [1363]    2651869    2794552    3235865    3802309    4197776    4553009
## [1369]    3558137    3844277    4237384    4442238    4593433    4827803
## [1375]    5048043    5199318    5302888    5383010    5410052    5447502
## [1381]    1489518    1533070    1582962    1646912    1694510    1746919
## [1387]    1861252    1945870    1999210    2011612    2011497    2009245
## [1393]    2526994    2780415    3080153    3428839    3840161    4353666
## [1399]    5828892    6921858    6099799    6633514    7753310    9118773
## [1405]   14264935   16151549   18356657   20997321   23935810   27129932
## [1411]   31140029   35933379   39964159   42835005   44433622   43997828
## [1417]   28549870   29841614   31158061   32850275   34513161   36439000
## [1423]   37983310   38880702   39549438   39855442   40152517   40448191
## [1429]    7982342    9128546   10421936   11737396   13016733   14116836
## [1435]   15410151   16495304   17587060   18698655   19576783   20378239
## [1441]    8504667    9753392   11183227   12716129   14597019   17104986
## [1447]   20367053   24725960   28227588   32160729   37090298   42292929
## [1453]     290243     326741     370006     420690     480105     551425
## [1459]     649901     779348     962344    1054486    1130269    1133066
## [1465]    7124673    7363802    7561588    7867931    8122293    8251648
## [1471]    8325260    8421403    8718867    8897619    8954175    9031088
## [1477]    4815000    5126000    5666000    6063000    6401400    6316424
## [1483]    6468126    6649942    6995447    7193761    7361757    7554661
## [1489]    3661549    4149908    4834621    5680812    6701172    7932503
## [1495]    9410494   11242847   13219062   15081016   17155814   19314747
## [1501]    8550362   10164215   11918938   13648692   15226039   16785196
## [1507]   18501390   19757799   20686918   21628605   22454239   23174294
## [1513]    8322925    9452826   10863958   12607312   14706593   17129565
## [1519]   19844382   23040630   26605473   30686889   34593779   38139640
## [1525]   21289402   25041917   29263397   34024249   39276153   44148285
## [1531]   48827160   52910342   56667095   60216677   62806748   65068149
## [1537]    1219113    1357445    1528098    1735550    2056351    2308582
## [1543]    2644765    3154264    3747553    4320890    4977378    5701579
## [1549]     662850     764900     887498     960155     975199    1039009
## [1555]    1116479    1191336    1183669    1138101    1101832    1056608
## [1561]    3647735    3950849    4286552    4786986    5303507    6005061
## [1567]    6734098    7724976    8523077    9231669    9770575   10276158
## [1573]   22235677   25670939   29788695   33411317   37492953   42404033
## [1579]   47328791   52881328   58179144   63047647   67308928   71158647
## [1585]    5824797    6675501    7688797    8900294   10190285   11457758
## [1591]   12939400   15283050   18252190   21210254   24739869   29170398
## [1597]   50430000   51430000   53292000   54959000   56079000   56179000
## [1603]   56339704   56981620   57866349   58808266   59912431   60776238
## [1609]  157553000  171984000  186538000  198712000  209896000  220239000
## [1615]  232187835  242803533  256894189  272911760  287675526  301139947
## [1621]    2252965    2424959    2598466    2748579    2829526    2873520
## [1627]    2953997    3045153    3149262    3262838    3363085    3447496
## [1633]    5439568    6702668    8143375    9709552   11515649   13503563
## [1639]   15620766   17910182   20265563   22374398   24287670   26084662
## [1645]   26246839   28998543   33796140   39463910   44655014   50533506
## [1651]   56142181   62826491   69940728   76048996   80908147   85262356
## [1657]    1030585    1070439    1133134    1142636    1089572    1261091
## [1663]    1425876    1691210    2104779    2826046    3389578    4018332
## [1669]    4963829    5498090    6120081    6740785    7407075    8403990
## [1675]    9657618   11219340   13367997   15826497   18701257   22211743
## [1681]    2672000    3016000    3421000    3900000    4506497    5216550
## [1687]    6100407    7272406    8381163    9417789   10595811   11746035
## [1693]    3080907    3646340    4277736    4995432    5861135    6642107
## [1699]    7636524    9216418   10704340   11404948   11926563   12311143
gdpPercap
##    [1]    779.4453    820.8530    853.1007    836.1971    739.9811    786.1134
##    [7]    978.0114    852.3959    649.3414    635.3414    726.7341    974.5803
##   [13]   1601.0561   1942.2842   2312.8890   2760.1969   3313.4222   3533.0039
##   [19]   3630.8807   3738.9327   2497.4379   3193.0546   4604.2117   5937.0295
##   [25]   2449.0082   3013.9760   2550.8169   3246.9918   4182.6638   4910.4168
##   [31]   5745.1602   5681.3585   5023.2166   4797.2951   5288.0404   6223.3675
##   [37]   3520.6103   3827.9405   4269.2767   5522.7764   5473.2880   3008.6474
##   [43]   2756.9537   2430.2083   2627.8457   2277.1409   2773.2873   4797.2313
##   [49]   5911.3151   6856.8562   7133.1660   8052.9530   9443.0385  10079.0267
##   [55]   8997.8974   9139.6714   9308.4187  10967.2820   8797.6407  12779.3796
##   [61]  10039.5956  10949.6496  12217.2269  14526.1246  16788.6295  18334.1975
##   [67]  19477.0093  21888.8890  23424.7668  26997.9366  30687.7547  34435.3674
##   [73]   6137.0765   8842.5980  10750.7211  12834.6024  16661.6256  19749.4223
##   [79]  21597.0836  23687.8261  27042.0187  29095.9207  32417.6077  36126.4927
##   [85]   9867.0848  11635.7995  12753.2751  14804.6727  18268.6584  19340.1020
##   [91]  19211.1473  18524.0241  19035.5792  20292.0168  23403.5593  29796.0483
##   [97]    684.2442    661.6375    686.3416    721.1861    630.2336    659.8772
##  [103]    676.9819    751.9794    837.8102    972.7700   1136.3904   1391.2538
##  [109]   8343.1051   9714.9606  10991.2068  13149.0412  16672.1436  19117.9745
##  [115]  20979.8459  22525.5631  25575.5707  27561.1966  30485.8838  33692.6051
##  [121]   1062.7522    959.6011    949.4991   1035.8314   1085.7969   1029.1613
##  [127]   1277.8976   1225.8560   1191.2077   1232.9753   1372.8779   1441.2849
##  [133]   2677.3263   2127.6863   2180.9725   2586.8861   2980.3313   3548.0978
##  [139]   3156.5105   2753.6915   2961.6997   3326.1432   3413.2627   3822.1371
##  [145]    973.5332   1353.9892   1709.6837   2172.3524   2860.1698   3528.4813
##  [151]   4126.6132   4314.1148   2546.7814   4766.3559   6018.9752   7446.2988
##  [157]    851.2411    918.2325    983.6540   1214.7093   2263.6111   3214.8578
##  [163]   4551.1421   6205.8839   7954.1116   8647.1423  11003.6051  12569.8518
##  [169]   2108.9444   2487.3660   3336.5858   3429.8644   4985.7115   6660.1187
##  [175]   7030.8359   7807.0958   6950.2830   7957.9808   8131.2128   9065.8008
##  [181]   2444.2866   3008.6707   4254.3378   5577.0028   6597.4944   7612.2404
##  [187]   8224.1916   8239.8548   6302.6234   5970.3888   7696.7777  10680.7928
##  [193]    543.2552    617.1835    722.5120    794.8266    854.7360    743.3870
##  [199]    807.1986    912.0631    931.7528    946.2950   1037.6452   1217.0330
##  [205]    339.2965    379.5646    355.2032    412.9775    464.0995    556.1033
##  [211]    559.6032    621.8188    631.6999    463.1151    446.4035    430.0707
##  [217]    368.4693    434.0383    496.9136    523.4323    421.6240    524.9722
##  [223]    624.4755    683.8956    682.3032    734.2852    896.2260   1713.7787
##  [229]   1172.6677   1313.0481   1399.6074   1508.4531   1684.1465   1783.4329
##  [235]   2367.9833   2602.6642   1793.1633   1694.3375   1934.0114   2042.0952
##  [241]  11367.1611  12489.9501  13462.4855  16076.5880  18970.5709  22090.8831
##  [247]  22898.7921  26626.5150  26342.8843  28954.9259  33328.9651  36319.2350
##  [253]   1071.3107   1190.8443   1193.0688   1136.0566   1070.0133   1109.3743
##  [259]    956.7530    844.8764    747.9055    740.5063    738.6906    706.0165
##  [265]   1178.6659   1308.4956   1389.8176   1196.8106   1104.1040   1133.9850
##  [271]    797.9081    952.3861   1058.0643   1004.9614   1156.1819   1704.0637
##  [277]   3939.9788   4315.6227   4519.0943   5106.6543   5494.0244   4756.7638
##  [283]   5095.6657   5547.0638   7596.1260  10118.0532  10778.7838  13171.6388
##  [289]    400.4486    575.9870    487.6740    612.7057    676.9001    741.2375
##  [295]    962.4214   1378.9040   1655.7842   2289.2341   3119.2809   4959.1149
##  [301]   2144.1151   2323.8056   2492.3511   2678.7298   3264.6600   3815.8079
##  [307]   4397.5757   4903.2191   5444.6486   6117.3617   5755.2600   7006.5804
##  [313]   1102.9909   1211.1485   1406.6483   1876.0296   1937.5777   1172.6030
##  [319]   1267.1001   1315.9808   1246.9074   1173.6182   1075.8116    986.1479
##  [325]    780.5423    905.8602    896.3146    861.5932    904.8961    795.7573
##  [331]    673.7478    672.7748    457.7192    312.1884    241.1659    277.5519
##  [337]   2125.6214   2315.0566   2464.7832   2677.9396   3213.1527   3259.1790
##  [343]   4879.5075   4201.1949   4016.2395   3484.1644   3484.0620   3632.5578
##  [349]   2627.0095   2990.0108   3460.9370   4161.7278   5118.1469   5926.8770
##  [355]   5262.7348   5629.9153   6160.4163   6677.0453   7723.4472   9645.0614
##  [361]   1388.5947   1500.8959   1728.8694   2052.0505   2378.2011   2517.7365
##  [367]   2602.7102   2156.9561   1648.0738   1786.2654   1648.8008   1544.7501
##  [373]   3119.2365   4338.2316   5477.8900   6960.2979   9164.0901  11305.3852
##  [379]  13221.8218  13822.5839   8447.7949   9875.6045  11628.3890  14619.2227
##  [385]   5586.5388   6092.1744   5180.7559   5690.2680   5305.4453   6380.4950
##  [391]   7316.9181   7532.9248   5592.8440   5431.9904   6340.6467   8948.1029
##  [397]   6876.1403   8256.3439  10136.8671  11399.4449  13108.4536  14800.1606
##  [403]  15377.2285  16310.4434  14297.0212  16048.5142  17596.2102  22833.3085
##  [409]   9692.3852  11099.6593  13583.3135  15937.2112  18866.2072  20422.9015
##  [415]  21688.0405  25116.1758  26406.7399  29804.3457  32166.5001  35278.4187
##  [421]   2669.5295   2864.9691   3020.9893   3020.0505   3694.2124   3081.7610
##  [427]   2879.4681   2880.1026   2377.1562   1895.0170   1908.2609   2082.4816
##  [433]   1397.7171   1544.4030   1662.1374   1653.7230   2189.8745   2681.9889
##  [439]   2861.0924   2899.8422   3044.2142   3614.1013   4563.8082   6025.3748
##  [445]   3522.1107   3780.5467   4086.1141   4579.0742   5280.9947   6679.6233
##  [451]   7213.7913   6481.7770   7103.7026   7429.4559   5773.0445   6873.2623
##  [457]   1418.8224   1458.9153   1693.3359   1814.8807   2024.0081   2785.4936
##  [463]   3503.7296   3885.4607   3794.7552   4173.1818   4754.6044   5581.1810
##  [469]   3048.3029   3421.5232   3776.8036   4358.5954   4520.2460   5138.9224
##  [475]   4098.3442   4140.4421   4444.2317   5154.8255   5351.5687   5728.3535
##  [481]    375.6431    426.0964    582.8420    915.5960    672.4123    958.5668
##  [487]    927.8253    966.8968   1132.0550   2814.4808   7703.4959  12154.0897
##  [493]    328.9406    344.1619    380.9958    468.7950    514.3242    505.7538
##  [499]    524.8758    521.1341    582.8585    913.4708    765.3500    641.3695
##  [505]    362.1463    378.9042    419.4564    516.1186    566.2439    556.8084
##  [511]    577.8607    573.7413    421.3535    515.8894    530.0535    690.8056
##  [517]   6424.5191   7545.4154   9371.8426  10921.6363  14358.8759  15605.4228
##  [523]  18533.1576  21141.0122  20647.1650  23723.9502  28204.5906  33207.0844
##  [529]   7029.8093   8662.8349  10560.4855  12999.9177  16107.1917  18292.6351
##  [535]  20293.8975  22066.4421  24703.7961  25889.7849  28926.0323  30470.0167
##  [541]   4293.4765   4976.1981   6631.4592   8358.7620  11401.9484  21745.5733
##  [547]  15113.3619  11864.4084  13522.1575  14722.8419  12521.7139  13206.4845
##  [553]    485.2307    520.9267    599.6503    734.7829    756.0868    884.7553
##  [559]    835.8096    611.6589    665.6244    653.7302    660.5856    752.7497
##  [565]   7144.1144  10187.8267  12902.4629  14745.6256  18016.1803  20512.9212
##  [571]  22031.5327  24639.1857  26505.3032  27788.8842  30035.8020  32170.3744
##  [577]    911.2989   1043.5615   1190.0411   1125.6972   1178.2237    993.2240
##  [583]    876.0326    847.0061    925.0602   1005.2458   1111.9846   1327.6089
##  [589]   3530.6901   4916.2999   6017.1907   8513.0970  12724.8296  14195.5243
##  [595]  15268.4209  16120.5284  17541.4963  18747.6981  22514.2548  27538.4119
##  [601]   2428.2378   2617.1560   2750.3644   3242.5311   4031.4083   4879.9927
##  [607]   4820.4948   4246.4860   4439.4508   4684.3138   4858.3475   5186.0500
##  [613]    510.1965    576.2670    686.3737    708.7595    741.6662    874.6859
##  [619]    857.2504    805.5725    794.3484    869.4498    945.5836    942.6542
##  [625]    299.8503    431.7905    522.0344    715.5806    820.2246    764.7260
##  [631]    838.1240    736.4154    745.5399    796.6645    575.7047    579.2317
##  [637]   1840.3669   1726.8879   1796.5890   1452.0577   1654.4569   1874.2989
##  [643]   2011.1595   1823.0160   1456.3095   1341.7269   1270.3649   1201.6372
##  [649]   2194.9262   2220.4877   2291.1568   2538.2694   2529.8423   3203.2081
##  [655]   3121.7608   3023.0967   3081.6946   3160.4549   3099.7287   3548.3308
##  [661]   3054.4212   3629.0765   4692.6483   6197.9628   8315.9281  11186.1413
##  [667]  14560.5305  20038.4727  24757.6030  28377.6322  30209.0152  39724.9787
##  [673]   5263.6738   6040.1800   7550.3599   9326.6447  10168.6561  11674.8374
##  [679]  12545.9907  12986.4800  10535.6285  11712.7768  14843.9356  18008.9444
##  [685]   7267.6884   9244.0014  10350.1591  13319.8957  15798.0636  19654.9625
##  [691]  23269.6075  26923.2063  25144.3920  28061.0997  31163.2020  36180.7892
##  [697]    546.5657    590.0620    658.3472    700.7706    724.0325    813.3373
##  [703]    855.7235    976.5127   1164.4068   1458.8174   1746.7695   2452.2104
##  [709]    749.6817    858.9003    849.2898    762.4318   1111.1079   1382.7021
##  [715]   1516.8730   1748.3570   2383.1409   3119.3356   2873.9129   3540.6516
##  [721]   3035.3260   3290.2576   4187.3298   5906.7318   9613.8186  11888.5951
##  [727]   7608.3346   6642.8814   7235.6532   8263.5903   9240.7620  11605.7145
##  [733]   4129.7661   6229.3336   8341.7378   8931.4598   9576.0376  14688.2351
##  [739]  14517.9071  11643.5727   3745.6407   3076.2398   4390.7173   4471.0619
##  [745]   5210.2803   5599.0779   6631.5973   7655.5690   9530.7729  11150.9811
##  [751]  12618.3214  13872.8665  17558.8155  24521.9471  34077.0494  40675.9964
##  [757]   4086.5221   5385.2785   7105.6307   8393.7414  12786.9322  13306.6192
##  [763]  15367.0292  17122.4799  18051.5225  20896.6092  21905.5951  25523.2771
##  [769]   4931.4042   6248.6562   8243.5823  10022.4013  12269.2738  14255.9847
##  [775]  16537.4835  19207.2348  22013.6449  24675.0245  27968.0982  28569.7197
##  [781]   2898.5309   4756.5258   5246.1075   6124.7035   7433.8893   6650.1956
##  [787]   6068.0513   6351.2375   7404.9237   7121.9247   6994.7749   7320.8803
##  [793]   3216.9563   4317.6944   6576.6495   9847.7886  14778.7864  16610.3770
##  [799]  19384.1057  22375.9419  26824.8951  28816.5850  28604.5919  31656.0681
##  [805]   1546.9078   1886.0806   2348.0092   2741.7963   2110.8563   2852.3516
##  [811]   4161.4160   4448.6799   3431.5936   3645.3796   3844.9172   4519.4612
##  [817]    853.5409    944.4383    896.9664   1056.7365   1222.3600   1267.6132
##  [823]   1348.2258   1361.9369   1341.9217   1360.4850   1287.5147   1463.2493
##  [829]   1088.2778   1571.1347   1621.6936   2143.5406   3701.6215   4106.3012
##  [835]   4106.5253   4106.4923   3726.0635   1690.7568   1646.7582   1593.0655
##  [841]   1030.5922   1487.5935   1536.3444   2029.2281   3030.8767   4657.2210
##  [847]   5622.9425   8533.0888  12104.2787  15993.5280  19233.9882  23348.1397
##  [853] 108382.3529 113523.1329  95458.1118  80894.8833 109347.8670  59265.4771
##  [859]  31354.0357  28118.4300  34932.9196  40300.6200  35110.1057  47306.9898
##  [865]   4834.8041   6089.7869   5714.5606   6006.9830   7486.3843   8659.6968
##  [871]   7640.5195   5377.0913   6890.8069   8754.9639   9313.9388  10461.0587
##  [877]    298.8462    335.9971    411.8006    498.6390    496.5816    745.3695
##  [883]    797.2631    773.9932    977.4863   1186.1480   1275.1846   1569.3314
##  [889]    575.5730    620.9700    634.1952    713.6036    803.0055    640.3224
##  [895]    572.1996    506.1139    636.6229    609.1740    531.4824    414.5073
##  [901]   2387.5481   3448.2844   6757.0308  18772.7517  21011.4972  21951.2118
##  [907]  17364.2754  11770.5898   9640.1385   9467.4461   9534.6775  12057.4993
##  [913]   1443.0117   1589.2027   1643.3871   1634.0473   1748.5630   1544.2286
##  [919]   1302.8787   1155.4419   1040.6762    986.2959    894.6371   1044.7701
##  [925]    369.1651    416.3698    427.9011    495.5148    584.6220    663.2237
##  [931]    632.8039    635.5174    563.2000    692.2758    665.4231    759.3499
##  [937]   1831.1329   1810.0670   2036.8849   2277.7424   2849.0948   3827.9216
##  [943]   4920.3560   5249.8027   7277.9128  10132.9096  10206.9779  12451.6558
##  [949]    452.3370    490.3822    496.1743    545.0099    581.3689    686.3953
##  [955]    618.0141    684.1716    739.0144    790.2580    951.4098   1042.5816
##  [961]    743.1159    846.1203   1055.8960   1421.1452   1586.8518   1497.4922
##  [967]   1481.1502   1421.6036   1361.3698   1483.1361   1579.0195   1803.1515
##  [973]   1967.9557   2034.0380   2529.0675   2475.3876   2575.4842   3710.9830
##  [979]   3688.0377   4783.5869   6058.2538   7425.7053   9021.8159  10956.9911
##  [985]   3478.1255   4131.5466   4581.6094   5754.7339   6809.4067   7674.9291
##  [991]   9611.1475   8688.1560   9472.3843   9767.2975  10742.4405  11977.5750
##  [997]    786.5669    912.6626   1056.3540   1226.0411   1421.7420   1647.5117
## [1003]   2000.6031   2338.0083   1785.4020   1902.2521   2140.7393   3095.7723
## [1009]   2647.5856   3682.2599   4649.5938   5907.8509   7778.4140   9595.9299
## [1015]  11222.5876  11732.5102   7003.3390   6465.6133   6557.1943   9253.8961
## [1021]   1688.2036   1642.0023   1566.3535   1711.0448   1930.1950   2370.6200
## [1027]   2702.6204   2755.0470   2948.0473   2982.1019   3258.4956   3820.1752
## [1033]    468.5260    495.5868    556.6864    566.6692    724.9178    502.3197
## [1039]    462.2114    389.8762    410.8968    472.3461    633.6179    823.6856
## [1045]    331.0000    350.0000    388.0000    349.0000    357.0000    371.0000
## [1051]    424.0000    385.0000    347.0000    415.0000    611.0000    944.0000
## [1057]   2423.7804   2621.4481   3173.2156   3793.6948   3746.0809   3876.4860
## [1063]   4191.1005   3693.7313   3804.5380   3899.5243   4072.3248   4811.0604
## [1069]    545.8657    597.9364    652.3969    676.4422    674.7881    694.1124
## [1075]    718.3731    775.6325    897.7404   1010.8921   1057.2063   1091.3598
## [1081]   8941.5719  11276.1934  12790.8496  15363.2514  18794.7457  21209.0592
## [1087]  21399.4605  23651.3236  26790.9496  30246.1306  33724.7578  36797.9333
## [1093]  10556.5757  12247.3953  13175.6780  14463.9189  16046.0373  16233.7177
## [1099]  17632.4104  19007.1913  18363.3249  21050.4138  23189.8014  25185.0091
## [1105]   3112.3639   3457.4159   3634.3644   4643.3935   4688.5933   5486.3711
## [1111]   3470.3382   2955.9844   2170.1517   2253.0230   2474.5488   2749.3210
## [1117]    761.8794    835.5234    997.7661   1054.3849    954.2092    808.8971
## [1123]    909.7221    668.3000    581.1827    580.3052    601.0745    619.6769
## [1129]   1077.2819   1100.5926   1150.9275   1014.5141   1698.3888   1981.9518
## [1135]   1576.9738   1385.0296   1619.8482   1624.9413   1615.2864   2013.9773
## [1141]  10095.4217  11653.9730  13450.4015  16361.8765  18965.0555  23311.3494
## [1147]  26298.6353  31540.9748  33965.6611  41283.1643  44683.9753  49357.1902
## [1153]   1828.2303   2242.7466   2924.6381   4720.9427  10618.0385  11848.3439
## [1159]  12954.7910  18115.2231  18616.7069  19702.0558  19774.8369  22316.1929
## [1165]    684.5971    747.0835    803.3427    942.4083   1049.9390   1175.9212
## [1171]   1443.4298   1704.6866   1971.8295   2049.3505   2092.7124   2605.9476
## [1177]   2480.3803   2961.8009   3536.5403   4421.0091   5364.2497   5351.9121
## [1183]   7009.6016   7034.7792   6618.7431   7113.6923   7356.0319   9809.1856
## [1189]   1952.3087   2046.1547   2148.0271   2299.3763   2523.3380   3248.3733
## [1195]   4258.5036   3998.8757   4196.4111   4247.4003   3783.6742   4172.8385
## [1201]   3758.5234   4245.2567   4957.0380   5788.0933   5937.8273   6281.2909
## [1207]   6434.5018   6360.9434   4446.3809   5838.3477   5909.0201   7408.9056
## [1213]   1272.8810   1547.9448   1649.5522   1814.1274   1989.3741   2373.2043
## [1219]   2603.2738   2189.6350   2279.3240   2536.5349   2650.9211   3190.4810
## [1225]   4029.3297   4734.2530   5338.7521   6557.1528   8006.5070   9508.1415
## [1231]   8451.5310   9082.3512   7738.8812  10159.5837  12002.2391  15389.9247
## [1237]   3068.3199   3774.5717   4727.9549   6361.5180   9022.2474  10172.4857
## [1243]  11753.8429  13039.3088  16207.2666  17641.0316  19970.9079  20509.6478
## [1249]   3081.9598   3907.1562   5108.3446   6929.2777   9123.0417   9770.5249
## [1255]  10330.9891  12281.3419  14641.5871  16999.4333  18855.6062  19328.7090
## [1261]   2718.8853   2769.4518   3173.7233   4021.1757   5047.6586   4319.8041
## [1267]   5267.2194   5303.3775   6101.2558   6071.9414   6316.1652   7670.1226
## [1273]   3144.6132   3943.3702   4734.9976   6470.8665   8011.4144   9356.3972
## [1279]   9605.3141   9696.2733   6598.4099   7346.5476   7885.3601  10808.4756
## [1285]    493.3239    540.2894    597.4731    510.9637    590.5807    670.0806
## [1291]    881.5706    847.9912    737.0686    589.9445    785.6538    863.0885
## [1297]    879.5836    860.7369   1071.5511   1384.8406   1532.9853   1737.5617
## [1303]   1890.2181   1516.5255   1428.7778   1339.0760   1353.0924   1598.4351
## [1309]   6459.5548   8157.5912  11626.4197  16903.0489  24837.4287  34167.7626
## [1315]  33693.1753  21198.2614  24841.6178  20586.6902  19014.5412  21654.8319
## [1321]   1450.3570   1567.6530   1654.9887   1612.4046   1597.7121   1561.7691
## [1327]   1518.4800   1441.7207   1367.8994   1392.3683   1519.6353   1712.4721
## [1333]   3581.4594   4981.0909   6289.6292   7991.7071  10522.0675  12980.6696
## [1339]  15181.0927  15870.8785   9325.0682   7914.3203   7236.0753   9786.5347
## [1345]    879.7877   1004.4844   1116.6399   1206.0435   1353.7598   1348.2852
## [1351]   1465.0108   1294.4478   1068.6963    574.6482    699.4897    862.5408
## [1357]   2315.1382   2843.1044   3674.7356   4977.4185   8597.7562  11210.0895
## [1363]  15169.1611  18861.5308  24769.8912  33519.4766  36023.1054  47143.1796
## [1369]   5074.6591   6093.2630   7481.1076   8412.9024   9674.1676  10922.6640
## [1375]  11348.5459  12037.2676   9498.4677  12126.2306  13638.7784  18678.3144
## [1381]   4215.0417   5862.2766   7402.3034   9405.4894  12383.4862  15277.0302
## [1387]  17866.7218  18678.5349  14214.7168  17161.1073  20660.0194  25768.2576
## [1393]   1135.7498   1258.1474   1369.4883   1284.7332   1254.5761   1450.9925
## [1399]   1176.8070   1093.2450    926.9603    930.5964    882.0818    926.1411
## [1405]   4725.2955   5487.1042   5768.7297   7114.4780   7765.9626   8028.6514
## [1411]   8568.2662   7825.8234   7225.0693   7479.1882   7710.9464   9269.6578
## [1417]   3834.0347   4564.8024   5693.8439   7993.5123  10638.7513  13236.9212
## [1423]  13926.1700  15764.9831  18603.0645  20445.2990  24835.4717  28821.0637
## [1429]   1083.5320   1072.5466   1074.4720   1135.5143   1213.3955   1348.7757
## [1435]   1648.0798   1876.7668   2153.7392   2664.4773   3015.3788   3970.0954
## [1441]   1615.9911   1770.3371   1959.5938   1687.9976   1659.6528   2202.9884
## [1447]   1895.5441   1507.8192   1492.1970   1632.2108   1993.3983   2602.3950
## [1453]   1148.3766   1244.7084   1856.1821   2613.1017   3364.8366   3781.4106
## [1459]   3895.3840   3984.8398   3553.0224   3876.7685   4128.1169   4513.4806
## [1465]   8527.8447   9911.8782  12329.4419  15258.2970  17832.0246  18855.7252
## [1471]  20667.3812  23586.9293  23880.0168  25266.5950  29341.6309  33859.7484
## [1477]  14734.2327  17909.4897  20431.0927  22966.1443  27195.1130  26982.2905
## [1483]  28397.7151  30281.7046  31871.5303  32135.3230  34480.9577  37506.4191
## [1489]   1643.4854   2117.2349   2193.0371   1881.9236   2571.4230   3195.4846
## [1495]   3761.8377   3116.7743   3340.5428   4014.2390   4090.9253   4184.5481
## [1501]   1206.9479   1507.8613   1822.8790   2643.8587   4062.5239   5596.5198
## [1507]   7426.3548  11054.5618  15215.6579  20206.8210  23235.4233  28718.2768
## [1513]    716.6501    698.5356    722.0038    848.2187    915.9851    962.4923
## [1519]    874.2426    831.8221    825.6825    789.1862    899.0742   1107.4822
## [1525]    757.7974    793.5774   1002.1992   1295.4607   1524.3589   1961.2246
## [1531]   2393.2198   2982.6538   4616.8965   5852.6255   5913.1875   7458.3963
## [1537]    859.8087    925.9083   1067.5348   1477.5968   1649.6602   1532.7770
## [1543]   1344.5780   1202.2014   1034.2989    982.2869    886.2206    882.9699
## [1549]   3023.2719   4100.3934   4997.5240   5621.3685   6619.5514   7899.5542
## [1555]   9119.5286   7388.5978   7370.9909   8792.5731  11460.6002  18008.5092
## [1561]   1468.4756   1395.2325   1660.3032   1932.3602   2753.2860   3120.8768
## [1567]   3560.2332   3810.4193   4332.7202   4876.7986   5722.8957   7092.9230
## [1573]   1969.1010   2218.7543   2322.8699   2826.3564   3450.6964   4269.1223
## [1579]   4241.3563   5089.0437   5678.3483   6601.4299   6508.0857   8458.2764
## [1585]    734.7535    774.3711    767.2717    908.9185    950.7359    843.7331
## [1591]    682.2662    617.7244    644.1708    816.5591    927.7210   1056.3801
## [1597]   9979.5085  11283.1779  12477.1771  14142.8509  15895.1164  17428.7485
## [1603]  18232.4245  21664.7877  22705.0925  26074.5314  29478.9992  33203.2613
## [1609]  13990.4821  14847.1271  16173.1459  19530.3656  21806.0359  24072.6321
## [1615]  25009.5591  29884.3504  32003.9322  35767.4330  39097.0995  42951.6531
## [1621]   5716.7667   6150.7730   5603.3577   5444.6196   5703.4089   6504.3397
## [1627]   6920.2231   7452.3990   8137.0048   9230.2407   7727.0020  10611.4630
## [1633]   7689.7998   9802.4665   8422.9742   9541.4742  10505.2597  13143.9510
## [1639]  11152.4101   9883.5846  10733.9263  10165.4952   8605.0478  11415.8057
## [1645]    605.0665    676.2854    772.0492    637.1233    699.5016    713.5371
## [1651]    707.2358    820.7994    989.0231   1385.8968   1764.4567   2441.5764
## [1657]   1515.5923   1827.0677   2198.9563   2649.7150   3133.4093   3682.8315
## [1663]   4336.0321   5107.1974   6017.6548   7110.6676   4515.4876   3025.3498
## [1669]    781.7176    804.8305    825.6232    862.4421   1265.0470   1829.7652
## [1675]   1977.5570   1971.7415   1879.4967   2117.4845   2234.8208   2280.7699
## [1681]   1147.3888   1311.9568   1452.7258   1777.0773   1773.4983   1588.6883
## [1687]   1408.6786   1213.3151   1210.8846   1071.3538   1071.6139   1271.2116
## [1693]    406.8841    518.7643    527.2722    569.7951    799.3622    685.5877
## [1699]    788.8550    706.1573    693.4208    792.4500    672.0386    469.7093

Cuántos individuos?

ncol(gapminder)# numero dde columnas
## [1] 6
nrow(gapminder) # numero de filas
## [1] 1704
dim(gapminder)
## [1] 1704    6

6 primeras filas de la base y 6 ultimas filas de la base.

head(gapminder) # 
## # A tibble: 6 × 6
##   country     continent  year lifeExp      pop gdpPercap
##   <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
## 1 Afghanistan Asia       1952    28.8  8425333      779.
## 2 Afghanistan Asia       1957    30.3  9240934      821.
## 3 Afghanistan Asia       1962    32.0 10267083      853.
## 4 Afghanistan Asia       1967    34.0 11537966      836.
## 5 Afghanistan Asia       1972    36.1 13079460      740.
## 6 Afghanistan Asia       1977    38.4 14880372      786.
tail(gapminder) # 
## # A tibble: 6 × 6
##   country  continent  year lifeExp      pop gdpPercap
##   <fct>    <fct>     <int>   <dbl>    <int>     <dbl>
## 1 Zimbabwe Africa     1982    60.4  7636524      789.
## 2 Zimbabwe Africa     1987    62.4  9216418      706.
## 3 Zimbabwe Africa     1992    60.4 10704340      693.
## 4 Zimbabwe Africa     1997    46.8 11404948      792.
## 5 Zimbabwe Africa     2002    40.0 11926563      672.
## 6 Zimbabwe Africa     2007    43.5 12311143      470.

Si se desean ver más datos

head(gapminder, n=20)
## # A tibble: 20 × 6
##    country     continent  year lifeExp      pop gdpPercap
##    <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
##  1 Afghanistan Asia       1952    28.8  8425333      779.
##  2 Afghanistan Asia       1957    30.3  9240934      821.
##  3 Afghanistan Asia       1962    32.0 10267083      853.
##  4 Afghanistan Asia       1967    34.0 11537966      836.
##  5 Afghanistan Asia       1972    36.1 13079460      740.
##  6 Afghanistan Asia       1977    38.4 14880372      786.
##  7 Afghanistan Asia       1982    39.9 12881816      978.
##  8 Afghanistan Asia       1987    40.8 13867957      852.
##  9 Afghanistan Asia       1992    41.7 16317921      649.
## 10 Afghanistan Asia       1997    41.8 22227415      635.
## 11 Afghanistan Asia       2002    42.1 25268405      727.
## 12 Afghanistan Asia       2007    43.8 31889923      975.
## 13 Albania     Europe     1952    55.2  1282697     1601.
## 14 Albania     Europe     1957    59.3  1476505     1942.
## 15 Albania     Europe     1962    64.8  1728137     2313.
## 16 Albania     Europe     1967    66.2  1984060     2760.
## 17 Albania     Europe     1972    67.7  2263554     3313.
## 18 Albania     Europe     1977    68.9  2509048     3533.
## 19 Albania     Europe     1982    70.4  2780097     3631.
## 20 Albania     Europe     1987    72    3075321     3739.





## Next Steps {#nextsteps .emphasized}




```r
library(DT)
datatable(iris, options = list(
  searching = FALSE,
  pageLength = 5,
  lengthMenu = c(5, 10, 15, 20)
))

Distribucion binomial

x <- 0:12
prob <- dbinom(x,12,.5)
barplot(prob,col = "red",ylim = c(0,.2),names.arg=x,
                           main="Binomial Distribution\n(n=12,p=0.5)")

library(dplyr)
library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
#library(scales)

data.frame(heads = 0:10, prob = dbinom(x = 0:10, size = 10, prob = 0.3)) %>%
  mutate(Heads = ifelse(heads == 2, "2", "other")) %>%
ggplot(aes(x = factor(heads), y = prob, fill = Heads)) +
    geom_col() +
    geom_text(
    aes(label = round(prob,2), y = prob + 0.01),
    position = position_dodge(0.9),
    size = 3,
    vjust = 0
      ) +
    labs(title = "Probability of X = 2 successes.",
       subtitle = "b(10, .3)",
       x = "Successes (x)",
       y = "probability") 

Reglas sintácticas

Demo colores

colors()
##   [1] "white"                "aliceblue"            "antiquewhite"        
##   [4] "antiquewhite1"        "antiquewhite2"        "antiquewhite3"       
##   [7] "antiquewhite4"        "aquamarine"           "aquamarine1"         
##  [10] "aquamarine2"          "aquamarine3"          "aquamarine4"         
##  [13] "azure"                "azure1"               "azure2"              
##  [16] "azure3"               "azure4"               "beige"               
##  [19] "bisque"               "bisque1"              "bisque2"             
##  [22] "bisque3"              "bisque4"              "black"               
##  [25] "blanchedalmond"       "blue"                 "blue1"               
##  [28] "blue2"                "blue3"                "blue4"               
##  [31] "blueviolet"           "brown"                "brown1"              
##  [34] "brown2"               "brown3"               "brown4"              
##  [37] "burlywood"            "burlywood1"           "burlywood2"          
##  [40] "burlywood3"           "burlywood4"           "cadetblue"           
##  [43] "cadetblue1"           "cadetblue2"           "cadetblue3"          
##  [46] "cadetblue4"           "chartreuse"           "chartreuse1"         
##  [49] "chartreuse2"          "chartreuse3"          "chartreuse4"         
##  [52] "chocolate"            "chocolate1"           "chocolate2"          
##  [55] "chocolate3"           "chocolate4"           "coral"               
##  [58] "coral1"               "coral2"               "coral3"              
##  [61] "coral4"               "cornflowerblue"       "cornsilk"            
##  [64] "cornsilk1"            "cornsilk2"            "cornsilk3"           
##  [67] "cornsilk4"            "cyan"                 "cyan1"               
##  [70] "cyan2"                "cyan3"                "cyan4"               
##  [73] "darkblue"             "darkcyan"             "darkgoldenrod"       
##  [76] "darkgoldenrod1"       "darkgoldenrod2"       "darkgoldenrod3"      
##  [79] "darkgoldenrod4"       "darkgray"             "darkgreen"           
##  [82] "darkgrey"             "darkkhaki"            "darkmagenta"         
##  [85] "darkolivegreen"       "darkolivegreen1"      "darkolivegreen2"     
##  [88] "darkolivegreen3"      "darkolivegreen4"      "darkorange"          
##  [91] "darkorange1"          "darkorange2"          "darkorange3"         
##  [94] "darkorange4"          "darkorchid"           "darkorchid1"         
##  [97] "darkorchid2"          "darkorchid3"          "darkorchid4"         
## [100] "darkred"              "darksalmon"           "darkseagreen"        
## [103] "darkseagreen1"        "darkseagreen2"        "darkseagreen3"       
## [106] "darkseagreen4"        "darkslateblue"        "darkslategray"       
## [109] "darkslategray1"       "darkslategray2"       "darkslategray3"      
## [112] "darkslategray4"       "darkslategrey"        "darkturquoise"       
## [115] "darkviolet"           "deeppink"             "deeppink1"           
## [118] "deeppink2"            "deeppink3"            "deeppink4"           
## [121] "deepskyblue"          "deepskyblue1"         "deepskyblue2"        
## [124] "deepskyblue3"         "deepskyblue4"         "dimgray"             
## [127] "dimgrey"              "dodgerblue"           "dodgerblue1"         
## [130] "dodgerblue2"          "dodgerblue3"          "dodgerblue4"         
## [133] "firebrick"            "firebrick1"           "firebrick2"          
## [136] "firebrick3"           "firebrick4"           "floralwhite"         
## [139] "forestgreen"          "gainsboro"            "ghostwhite"          
## [142] "gold"                 "gold1"                "gold2"               
## [145] "gold3"                "gold4"                "goldenrod"           
## [148] "goldenrod1"           "goldenrod2"           "goldenrod3"          
## [151] "goldenrod4"           "gray"                 "gray0"               
## [154] "gray1"                "gray2"                "gray3"               
## [157] "gray4"                "gray5"                "gray6"               
## [160] "gray7"                "gray8"                "gray9"               
## [163] "gray10"               "gray11"               "gray12"              
## [166] "gray13"               "gray14"               "gray15"              
## [169] "gray16"               "gray17"               "gray18"              
## [172] "gray19"               "gray20"               "gray21"              
## [175] "gray22"               "gray23"               "gray24"              
## [178] "gray25"               "gray26"               "gray27"              
## [181] "gray28"               "gray29"               "gray30"              
## [184] "gray31"               "gray32"               "gray33"              
## [187] "gray34"               "gray35"               "gray36"              
## [190] "gray37"               "gray38"               "gray39"              
## [193] "gray40"               "gray41"               "gray42"              
## [196] "gray43"               "gray44"               "gray45"              
## [199] "gray46"               "gray47"               "gray48"              
## [202] "gray49"               "gray50"               "gray51"              
## [205] "gray52"               "gray53"               "gray54"              
## [208] "gray55"               "gray56"               "gray57"              
## [211] "gray58"               "gray59"               "gray60"              
## [214] "gray61"               "gray62"               "gray63"              
## [217] "gray64"               "gray65"               "gray66"              
## [220] "gray67"               "gray68"               "gray69"              
## [223] "gray70"               "gray71"               "gray72"              
## [226] "gray73"               "gray74"               "gray75"              
## [229] "gray76"               "gray77"               "gray78"              
## [232] "gray79"               "gray80"               "gray81"              
## [235] "gray82"               "gray83"               "gray84"              
## [238] "gray85"               "gray86"               "gray87"              
## [241] "gray88"               "gray89"               "gray90"              
## [244] "gray91"               "gray92"               "gray93"              
## [247] "gray94"               "gray95"               "gray96"              
## [250] "gray97"               "gray98"               "gray99"              
## [253] "gray100"              "green"                "green1"              
## [256] "green2"               "green3"               "green4"              
## [259] "greenyellow"          "grey"                 "grey0"               
## [262] "grey1"                "grey2"                "grey3"               
## [265] "grey4"                "grey5"                "grey6"               
## [268] "grey7"                "grey8"                "grey9"               
## [271] "grey10"               "grey11"               "grey12"              
## [274] "grey13"               "grey14"               "grey15"              
## [277] "grey16"               "grey17"               "grey18"              
## [280] "grey19"               "grey20"               "grey21"              
## [283] "grey22"               "grey23"               "grey24"              
## [286] "grey25"               "grey26"               "grey27"              
## [289] "grey28"               "grey29"               "grey30"              
## [292] "grey31"               "grey32"               "grey33"              
## [295] "grey34"               "grey35"               "grey36"              
## [298] "grey37"               "grey38"               "grey39"              
## [301] "grey40"               "grey41"               "grey42"              
## [304] "grey43"               "grey44"               "grey45"              
## [307] "grey46"               "grey47"               "grey48"              
## [310] "grey49"               "grey50"               "grey51"              
## [313] "grey52"               "grey53"               "grey54"              
## [316] "grey55"               "grey56"               "grey57"              
## [319] "grey58"               "grey59"               "grey60"              
## [322] "grey61"               "grey62"               "grey63"              
## [325] "grey64"               "grey65"               "grey66"              
## [328] "grey67"               "grey68"               "grey69"              
## [331] "grey70"               "grey71"               "grey72"              
## [334] "grey73"               "grey74"               "grey75"              
## [337] "grey76"               "grey77"               "grey78"              
## [340] "grey79"               "grey80"               "grey81"              
## [343] "grey82"               "grey83"               "grey84"              
## [346] "grey85"               "grey86"               "grey87"              
## [349] "grey88"               "grey89"               "grey90"              
## [352] "grey91"               "grey92"               "grey93"              
## [355] "grey94"               "grey95"               "grey96"              
## [358] "grey97"               "grey98"               "grey99"              
## [361] "grey100"              "honeydew"             "honeydew1"           
## [364] "honeydew2"            "honeydew3"            "honeydew4"           
## [367] "hotpink"              "hotpink1"             "hotpink2"            
## [370] "hotpink3"             "hotpink4"             "indianred"           
## [373] "indianred1"           "indianred2"           "indianred3"          
## [376] "indianred4"           "ivory"                "ivory1"              
## [379] "ivory2"               "ivory3"               "ivory4"              
## [382] "khaki"                "khaki1"               "khaki2"              
## [385] "khaki3"               "khaki4"               "lavender"            
## [388] "lavenderblush"        "lavenderblush1"       "lavenderblush2"      
## [391] "lavenderblush3"       "lavenderblush4"       "lawngreen"           
## [394] "lemonchiffon"         "lemonchiffon1"        "lemonchiffon2"       
## [397] "lemonchiffon3"        "lemonchiffon4"        "lightblue"           
## [400] "lightblue1"           "lightblue2"           "lightblue3"          
## [403] "lightblue4"           "lightcoral"           "lightcyan"           
## [406] "lightcyan1"           "lightcyan2"           "lightcyan3"          
## [409] "lightcyan4"           "lightgoldenrod"       "lightgoldenrod1"     
## [412] "lightgoldenrod2"      "lightgoldenrod3"      "lightgoldenrod4"     
## [415] "lightgoldenrodyellow" "lightgray"            "lightgreen"          
## [418] "lightgrey"            "lightpink"            "lightpink1"          
## [421] "lightpink2"           "lightpink3"           "lightpink4"          
## [424] "lightsalmon"          "lightsalmon1"         "lightsalmon2"        
## [427] "lightsalmon3"         "lightsalmon4"         "lightseagreen"       
## [430] "lightskyblue"         "lightskyblue1"        "lightskyblue2"       
## [433] "lightskyblue3"        "lightskyblue4"        "lightslateblue"      
## [436] "lightslategray"       "lightslategrey"       "lightsteelblue"      
## [439] "lightsteelblue1"      "lightsteelblue2"      "lightsteelblue3"     
## [442] "lightsteelblue4"      "lightyellow"          "lightyellow1"        
## [445] "lightyellow2"         "lightyellow3"         "lightyellow4"        
## [448] "limegreen"            "linen"                "magenta"             
## [451] "magenta1"             "magenta2"             "magenta3"            
## [454] "magenta4"             "maroon"               "maroon1"             
## [457] "maroon2"              "maroon3"              "maroon4"             
## [460] "mediumaquamarine"     "mediumblue"           "mediumorchid"        
## [463] "mediumorchid1"        "mediumorchid2"        "mediumorchid3"       
## [466] "mediumorchid4"        "mediumpurple"         "mediumpurple1"       
## [469] "mediumpurple2"        "mediumpurple3"        "mediumpurple4"       
## [472] "mediumseagreen"       "mediumslateblue"      "mediumspringgreen"   
## [475] "mediumturquoise"      "mediumvioletred"      "midnightblue"        
## [478] "mintcream"            "mistyrose"            "mistyrose1"          
## [481] "mistyrose2"           "mistyrose3"           "mistyrose4"          
## [484] "moccasin"             "navajowhite"          "navajowhite1"        
## [487] "navajowhite2"         "navajowhite3"         "navajowhite4"        
## [490] "navy"                 "navyblue"             "oldlace"             
## [493] "olivedrab"            "olivedrab1"           "olivedrab2"          
## [496] "olivedrab3"           "olivedrab4"           "orange"              
## [499] "orange1"              "orange2"              "orange3"             
## [502] "orange4"              "orangered"            "orangered1"          
## [505] "orangered2"           "orangered3"           "orangered4"          
## [508] "orchid"               "orchid1"              "orchid2"             
## [511] "orchid3"              "orchid4"              "palegoldenrod"       
## [514] "palegreen"            "palegreen1"           "palegreen2"          
## [517] "palegreen3"           "palegreen4"           "paleturquoise"       
## [520] "paleturquoise1"       "paleturquoise2"       "paleturquoise3"      
## [523] "paleturquoise4"       "palevioletred"        "palevioletred1"      
## [526] "palevioletred2"       "palevioletred3"       "palevioletred4"      
## [529] "papayawhip"           "peachpuff"            "peachpuff1"          
## [532] "peachpuff2"           "peachpuff3"           "peachpuff4"          
## [535] "peru"                 "pink"                 "pink1"               
## [538] "pink2"                "pink3"                "pink4"               
## [541] "plum"                 "plum1"                "plum2"               
## [544] "plum3"                "plum4"                "powderblue"          
## [547] "purple"               "purple1"              "purple2"             
## [550] "purple3"              "purple4"              "red"                 
## [553] "red1"                 "red2"                 "red3"                
## [556] "red4"                 "rosybrown"            "rosybrown1"          
## [559] "rosybrown2"           "rosybrown3"           "rosybrown4"          
## [562] "royalblue"            "royalblue1"           "royalblue2"          
## [565] "royalblue3"           "royalblue4"           "saddlebrown"         
## [568] "salmon"               "salmon1"              "salmon2"             
## [571] "salmon3"              "salmon4"              "sandybrown"          
## [574] "seagreen"             "seagreen1"            "seagreen2"           
## [577] "seagreen3"            "seagreen4"            "seashell"            
## [580] "seashell1"            "seashell2"            "seashell3"           
## [583] "seashell4"            "sienna"               "sienna1"             
## [586] "sienna2"              "sienna3"              "sienna4"             
## [589] "skyblue"              "skyblue1"             "skyblue2"            
## [592] "skyblue3"             "skyblue4"             "slateblue"           
## [595] "slateblue1"           "slateblue2"           "slateblue3"          
## [598] "slateblue4"           "slategray"            "slategray1"          
## [601] "slategray2"           "slategray3"           "slategray4"          
## [604] "slategrey"            "snow"                 "snow1"               
## [607] "snow2"                "snow3"                "snow4"               
## [610] "springgreen"          "springgreen1"         "springgreen2"        
## [613] "springgreen3"         "springgreen4"         "steelblue"           
## [616] "steelblue1"           "steelblue2"           "steelblue3"          
## [619] "steelblue4"           "tan"                  "tan1"                
## [622] "tan2"                 "tan3"                 "tan4"                
## [625] "thistle"              "thistle1"             "thistle2"            
## [628] "thistle3"             "thistle4"             "tomato"              
## [631] "tomato1"              "tomato2"              "tomato3"             
## [634] "tomato4"              "turquoise"            "turquoise1"          
## [637] "turquoise2"           "turquoise3"           "turquoise4"          
## [640] "violet"               "violetred"            "violetred1"          
## [643] "violetred2"           "violetred3"           "violetred4"          
## [646] "wheat"                "wheat1"               "wheat2"              
## [649] "wheat3"               "wheat4"               "whitesmoke"          
## [652] "yellow"               "yellow1"              "yellow2"             
## [655] "yellow3"              "yellow4"              "yellowgreen"
demo(colors)
## 
## 
##  demo(colors)
##  ---- ~~~~~~
## 
## > ### ----------- Show (almost) all named colors ---------------------
## > 
## > ## 1) with traditional 'graphics' package:
## > showCols1 <- function(bg = "gray", cex = 0.75, srt = 30) {
## +     m <- ceiling(sqrt(n <- length(cl <- colors())))
## +     length(cl) <- m*m; cm <- matrix(cl, m)
## +     ##
## +     require("graphics")
## +     op <- par(mar=rep(0,4), ann=FALSE, bg = bg); on.exit(par(op))
## +     plot(1:m,1:m, type="n", axes=FALSE)
## +     text(col(cm), rev(row(cm)), cm,  col = cl, cex=cex, srt=srt)
## + }
## 
## > showCols1()
## 
## > ## 2) with 'grid' package:
## > showCols2 <- function(bg = "grey", cex = 0.75, rot = 30) {
## +     m <- ceiling(sqrt(n <- length(cl <- colors())))
## +     length(cl) <- m*m; cm <- matrix(cl, m)
## +     ##
## +     require("grid")
## +     grid.newpage(); vp <- viewport(width = .92, height = .92)
## +     grid.rect(gp=gpar(fill=bg))
## +     grid.text(cm, x = col(cm)/m, y = rev(row(cm))/m, rot = rot,
## +               vp=vp, gp=gpar(cex = cex, col = cm))
## + }
## 
## > showCols2()
## Loading required package: grid

## 
## > showCols2(bg = "gray33")

## 
## > ###
## > 
## > ##' @title Comparing Colors
## > ##' @param col
## > ##' @param nrow
## > ##' @param ncol
## > ##' @param txt.col
## > ##' @return the grid layout, invisibly
## > ##' @author Marius Hofert, originally
## > plotCol <- function(col, nrow=1, ncol=ceiling(length(col) / nrow),
## +                     txt.col="black") {
## +     stopifnot(nrow >= 1, ncol >= 1)
## +     if(length(col) > nrow*ncol)
## +         warning("some colors will not be shown")
## +     require(grid)
## +     grid.newpage()
## +     gl <- grid.layout(nrow, ncol)
## +     pushViewport(viewport(layout=gl))
## +     ic <- 1
## +     for(i in 1:nrow) {
## +         for(j in 1:ncol) {
## +             pushViewport(viewport(layout.pos.row=i, layout.pos.col=j))
## +             grid.rect(gp= gpar(fill=col[ic]))
## +             grid.text(col[ic], gp=gpar(col=txt.col))
## +             upViewport()
## +             ic <- ic+1
## +         }
## +     }
## +     upViewport()
## +     invisible(gl)
## + }
## 
## > ## A Chocolate Bar of colors:
## > plotCol(c("#CC8C3C", paste0("chocolate", 2:4),
## +           paste0("darkorange", c("",1:2)), paste0("darkgoldenrod", 1:2),
## +           "orange", "orange1", "sandybrown", "tan1", "tan2"),
## +         nrow=2)

## 
## > ##' Find close R colors() to a given color {original by Marius Hofert)
## > ##' using Euclidean norm in (HSV / RGB / ...) color space
## > nearRcolor <- function(rgb, cSpace = c("hsv", "rgb255", "Luv", "Lab"),
## +                        dist = switch(cSpace, "hsv" = 0.10, "rgb255" = 30,
## +                        "Luv" = 15, "Lab" = 12))
## + {
## +     if(is.character(rgb)) rgb <- col2rgb(rgb)
## +     stopifnot(length(rgb <- as.vector(rgb)) == 3)
## +     Rcol <- col2rgb(.cc <- colors())
## +     uniqC <- !duplicated(t(Rcol)) # gray9 == grey9 (etc)
## +     Rcol <- Rcol[, uniqC] ; .cc <- .cc[uniqC]
## +     cSpace <- match.arg(cSpace)
## +     convRGB2 <- function(Rgb, to)
## +         t(convertColor(t(Rgb), from="sRGB", to=to, scale.in=255))
## +     ## the transformation,  rgb{0..255} --> cSpace :
## +     TransF <- switch(cSpace,
## +                      "rgb255" = identity,
## +                      "hsv" = rgb2hsv,
## +                      "Luv" = function(RGB) convRGB2(RGB, "Luv"),
## +                      "Lab" = function(RGB) convRGB2(RGB, "Lab"))
## +     d <- sqrt(colSums((TransF(Rcol) - as.vector(TransF(rgb)))^2))
## +     iS <- sort.list(d[near <- d <= dist])# sorted: closest first
## +     setNames(.cc[near][iS], format(zapsmall(d[near][iS]), digits=3))
## + }
## 
## > nearRcolor(col2rgb("tan2"), "rgb")
##          0.0         21.1         25.8         29.5 
##       "tan2"       "tan1" "sandybrown"    "sienna1" 
## 
## > nearRcolor(col2rgb("tan2"), "hsv")
##       0.0000       0.0410       0.0618       0.0638       0.0667       0.0766 
##       "tan2"    "sienna2"     "coral2"    "tomato2"       "tan1"      "coral" 
##       0.0778       0.0900       0.0912       0.0918 
##    "sienna1" "sandybrown"     "coral1"     "tomato" 
## 
## > nearRcolor(col2rgb("tan2"), "Luv")
##         0.00         7.42         7.48        12.41        13.69 
##       "tan2"       "tan1" "sandybrown"    "orange3"    "orange2" 
## 
## > nearRcolor(col2rgb("tan2"), "Lab")
##         0.00         5.56         8.08        11.31 
##       "tan2"       "tan1" "sandybrown"       "peru" 
## 
## > nearRcolor("#334455")
##          0.0867 
## "darkslategray" 
## 
## > ## Now, consider choosing a color by looking in the
## > ## neighborhood of one you know :
## > 
## > plotCol(nearRcolor("deepskyblue", "rgb", dist=50))

## 
## > plotCol(nearRcolor("deepskyblue", dist=.1))

## 
## > plotCol(nearRcolor("tomato", "rgb", dist= 50), nrow=3)

## 
## > plotCol(nearRcolor("tomato", "hsv", dist=.12), nrow=3)

## 
## > plotCol(nearRcolor("tomato", "Luv", dist= 25), nrow=3)

## 
## > plotCol(nearRcolor("tomato", "Lab", dist= 18), nrow=3)

Demo gráficas

demo(graphics)
## 
## 
##  demo(graphics)
##  ---- ~~~~~~~~
## 
## > #  Copyright (C) 1997-2009 The R Core Team
## > 
## > require(datasets)
## 
## > require(grDevices); require(graphics)
## 
## > ## Here is some code which illustrates some of the differences between
## > ## R and S graphics capabilities.  Note that colors are generally specified
## > ## by a character string name (taken from the X11 rgb.txt file) and that line
## > ## textures are given similarly.  The parameter "bg" sets the background
## > ## parameter for the plot and there is also an "fg" parameter which sets
## > ## the foreground color.
## > 
## > 
## > x <- stats::rnorm(50)
## 
## > opar <- par(bg = "white")
## 
## > plot(x, ann = FALSE, type = "n")

## 
## > abline(h = 0, col = gray(.90))
## 
## > lines(x, col = "green4", lty = "dotted")
## 
## > points(x, bg = "limegreen", pch = 21)
## 
## > title(main = "Simple Use of Color In a Plot",
## +       xlab = "Just a Whisper of a Label",
## +       col.main = "blue", col.lab = gray(.8),
## +       cex.main = 1.2, cex.lab = 1.0, font.main = 4, font.lab = 3)
## 
## > ## A little color wheel.    This code just plots equally spaced hues in
## > ## a pie chart.    If you have a cheap SVGA monitor (like me) you will
## > ## probably find that numerically equispaced does not mean visually
## > ## equispaced.  On my display at home, these colors tend to cluster at
## > ## the RGB primaries.  On the other hand on the SGI Indy at work the
## > ## effect is near perfect.
## > 
## > par(bg = "gray")
## 
## > pie(rep(1,24), col = rainbow(24), radius = 0.9)

## 
## > title(main = "A Sample Color Wheel", cex.main = 1.4, font.main = 3)
## 
## > title(xlab = "(Use this as a test of monitor linearity)",
## +       cex.lab = 0.8, font.lab = 3)
## 
## > ## We have already confessed to having these.  This is just showing off X11
## > ## color names (and the example (from the postscript manual) is pretty "cute".
## > 
## > pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)
## 
## > names(pie.sales) <- c("Blueberry", "Cherry",
## +              "Apple", "Boston Cream", "Other", "Vanilla Cream")
## 
## > pie(pie.sales,
## +     col = c("purple","violetred1","green3","cornsilk","cyan","white"))

## 
## > title(main = "January Pie Sales", cex.main = 1.8, font.main = 1)
## 
## > title(xlab = "(Don't try this at home kids)", cex.lab = 0.8, font.lab = 3)
## 
## > ## Boxplots:  I couldn't resist the capability for filling the "box".
## > ## The use of color seems like a useful addition, it focuses attention
## > ## on the central bulk of the data.
## > 
## > par(bg="cornsilk")
## 
## > n <- 10
## 
## > g <- gl(n, 100, n*100)
## 
## > x <- rnorm(n*100) + sqrt(as.numeric(g))
## 
## > boxplot(split(x,g), col="lavender", notch=TRUE)

## 
## > title(main="Notched Boxplots", xlab="Group", font.main=4, font.lab=1)
## 
## > ## An example showing how to fill between curves.
## > 
## > par(bg="white")
## 
## > n <- 100
## 
## > x <- c(0,cumsum(rnorm(n)))
## 
## > y <- c(0,cumsum(rnorm(n)))
## 
## > xx <- c(0:n, n:0)
## 
## > yy <- c(x, rev(y))
## 
## > plot(xx, yy, type="n", xlab="Time", ylab="Distance")

## 
## > polygon(xx, yy, col="gray")
## 
## > title("Distance Between Brownian Motions")
## 
## > ## Colored plot margins, axis labels and titles.    You do need to be
## > ## careful with these kinds of effects.    It's easy to go completely
## > ## over the top and you can end up with your lunch all over the keyboard.
## > ## On the other hand, my market research clients love it.
## > 
## > x <- c(0.00, 0.40, 0.86, 0.85, 0.69, 0.48, 0.54, 1.09, 1.11, 1.73, 2.05, 2.02)
## 
## > par(bg="lightgray")
## 
## > plot(x, type="n", axes=FALSE, ann=FALSE)

## 
## > usr <- par("usr")
## 
## > rect(usr[1], usr[3], usr[2], usr[4], col="cornsilk", border="black")
## 
## > lines(x, col="blue")
## 
## > points(x, pch=21, bg="lightcyan", cex=1.25)
## 
## > axis(2, col.axis="blue", las=1)
## 
## > axis(1, at=1:12, lab=month.abb, col.axis="blue")
## 
## > box()
## 
## > title(main= "The Level of Interest in R", font.main=4, col.main="red")
## 
## > title(xlab= "1996", col.lab="red")
## 
## > ## A filled histogram, showing how to change the font used for the
## > ## main title without changing the other annotation.
## > 
## > par(bg="cornsilk")
## 
## > x <- rnorm(1000)
## 
## > hist(x, xlim=range(-4, 4, x), col="lavender", main="")

## 
## > title(main="1000 Normal Random Variates", font.main=3)
## 
## > ## A scatterplot matrix
## > ## The good old Iris data (yet again)
## > 
## > pairs(iris[1:4], main="Edgar Anderson's Iris Data", font.main=4, pch=19)

## 
## > pairs(iris[1:4], main="Edgar Anderson's Iris Data", pch=21,
## +       bg = c("red", "green3", "blue")[unclass(iris$Species)])

## 
## > ## Contour plotting
## > ## This produces a topographic map of one of Auckland's many volcanic "peaks".
## > 
## > x <- 10*1:nrow(volcano)
## 
## > y <- 10*1:ncol(volcano)
## 
## > lev <- pretty(range(volcano), 10)
## 
## > par(bg = "lightcyan")
## 
## > pin <- par("pin")
## 
## > xdelta <- diff(range(x))
## 
## > ydelta <- diff(range(y))
## 
## > xscale <- pin[1]/xdelta
## 
## > yscale <- pin[2]/ydelta
## 
## > scale <- min(xscale, yscale)
## 
## > xadd <- 0.5*(pin[1]/scale - xdelta)
## 
## > yadd <- 0.5*(pin[2]/scale - ydelta)
## 
## > plot(numeric(0), numeric(0),
## +      xlim = range(x)+c(-1,1)*xadd, ylim = range(y)+c(-1,1)*yadd,
## +      type = "n", ann = FALSE)

## 
## > usr <- par("usr")
## 
## > rect(usr[1], usr[3], usr[2], usr[4], col="green3")
## 
## > contour(x, y, volcano, levels = lev, col="yellow", lty="solid", add=TRUE)
## 
## > box()
## 
## > title("A Topographic Map of Maunga Whau", font= 4)
## 
## > title(xlab = "Meters North", ylab = "Meters West", font= 3)
## 
## > mtext("10 Meter Contour Spacing", side=3, line=0.35, outer=FALSE,
## +       at = mean(par("usr")[1:2]), cex=0.7, font=3)
## 
## > ## Conditioning plots
## > 
## > par(bg="cornsilk")
## 
## > coplot(lat ~ long | depth, data = quakes, pch = 21, bg = "green3")

## 
## > par(opar)

Demo Imagenes

demo(image)
## 
## 
##  demo(image)
##  ---- ~~~~~
## 
## > #  Copyright (C) 1997-2009 The R Core Team
## > 
## > require(datasets)
## 
## > require(grDevices); require(graphics)
## 
## > x <- 10*(1:nrow(volcano)); x.at <- seq(100, 800, by=100)
## 
## > y <- 10*(1:ncol(volcano)); y.at <- seq(100, 600, by=100)
## 
## >                    # Using Terrain Colors
## > 
## > image(x, y, volcano, col=terrain.colors(100),axes=FALSE)

## 
## > contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="brown")
## 
## > axis(1, at=x.at)
## 
## > axis(2, at=y.at)
## 
## > box()
## 
## > title(main="Maunga Whau Volcano", sub = "col=terrain.colors(100)", font.main=4)
## 
## >                    # Using Heat Colors
## > 
## > image(x, y, volcano, col=heat.colors(100), axes=FALSE)

## 
## > contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="brown")
## 
## > axis(1, at=x.at)
## 
## > axis(2, at=y.at)
## 
## > box()
## 
## > title(main="Maunga Whau Volcano", sub = "col=heat.colors(100)", font.main=4)
## 
## >                    # Using Gray Scale
## > 
## > image(x, y, volcano, col=gray(100:200/200), axes=FALSE)

## 
## > contour(x, y, volcano, levels=seq(90, 200, by=5), add=TRUE, col="black")
## 
## > axis(1, at=x.at)
## 
## > axis(2, at=y.at)
## 
## > box()
## 
## > title(main="Maunga Whau Volcano \n col=gray(100:200/200)", font.main=4)
## 
## > ## Filled Contours are even nicer sometimes :
## > example(filled.contour)
## 
## flld.c> require("grDevices") # for colours
## 
## flld.c> filled.contour(volcano, asp = 1) # simple

## 
## flld.c> x <- 10*1:nrow(volcano)
## 
## flld.c> y <- 10*1:ncol(volcano)
## 
## flld.c> filled.contour(x, y, volcano,
## flld.c+     color.palette = function(n) hcl.colors(n, "terrain"),
## flld.c+     plot.title = title(main = "The Topography of Maunga Whau",
## flld.c+     xlab = "Meters North", ylab = "Meters West"),
## flld.c+     plot.axes = { axis(1, seq(100, 800, by = 100))
## flld.c+                   axis(2, seq(100, 600, by = 100)) },
## flld.c+     key.title = title(main = "Height\n(meters)"),
## flld.c+     key.axes = axis(4, seq(90, 190, by = 10)))  # maybe also asp = 1

## 
## flld.c> mtext(paste("filled.contour(.) from", R.version.string),
## flld.c+       side = 1, line = 4, adj = 1, cex = .66)
## 
## flld.c> # Annotating a filled contour plot
## flld.c> a <- expand.grid(1:20, 1:20)
## 
## flld.c> b <- matrix(a[,1] + a[,2], 20)
## 
## flld.c> filled.contour(x = 1:20, y = 1:20, z = b,
## flld.c+                plot.axes = { axis(1); axis(2); points(10, 10) })

## 
## flld.c> ## Persian Rug Art:
## flld.c> x <- y <- seq(-4*pi, 4*pi, length.out = 27)
## 
## flld.c> r <- sqrt(outer(x^2, y^2, "+"))
## 
## flld.c> filled.contour(cos(r^2)*exp(-r/(2*pi)), axes = FALSE)

## 
## flld.c> ## rather, the key *should* be labeled:
## flld.c> filled.contour(cos(r^2)*exp(-r/(2*pi)), frame.plot = FALSE,
## flld.c+                plot.axes = {})

Demo persp

demo(persp)
## 
## 
##  demo(persp)
##  ---- ~~~~~
## 
## > ### Demos for  persp()  plots   -- things not in  example(persp)
## > ### -------------------------
## > 
## > require(datasets)
## 
## > require(grDevices); require(graphics)
## 
## > ## (1) The Obligatory Mathematical surface.
## > ##     Rotated sinc function.
## > 
## > x <- seq(-10, 10, length.out = 50)
## 
## > y <- x
## 
## > rotsinc <- function(x,y)
## + {
## +     sinc <- function(x) { y <- sin(x)/x ; y[is.na(y)] <- 1; y }
## +     10 * sinc( sqrt(x^2+y^2) )
## + }
## 
## > sinc.exp <- expression(z == Sinc(sqrt(x^2 + y^2)))
## 
## > z <- outer(x, y, rotsinc)
## 
## > oldpar <- par(bg = "white")
## 
## > persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue")

## 
## > title(sub=".")## work around persp+plotmath bug
## 
## > title(main = sinc.exp)
## 
## > persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue",
## +       ltheta = 120, shade = 0.75, ticktype = "detailed",
## +       xlab = "X", ylab = "Y", zlab = "Z")

## 
## > title(sub=".")## work around persp+plotmath bug
## 
## > title(main = sinc.exp)
## 
## > ## (2) Visualizing a simple DEM model
## > 
## > z <- 2 * volcano        # Exaggerate the relief
## 
## > x <- 10 * (1:nrow(z))   # 10 meter spacing (S to N)
## 
## > y <- 10 * (1:ncol(z))   # 10 meter spacing (E to W)
## 
## > persp(x, y, z, theta = 120, phi = 15, scale = FALSE, axes = FALSE)

## 
## > ## (3) Now something more complex
## > ##     We border the surface, to make it more "slice like"
## > ##     and color the top and sides of the surface differently.
## > 
## > z0 <- min(z) - 20
## 
## > z <- rbind(z0, cbind(z0, z, z0), z0)
## 
## > x <- c(min(x) - 1e-10, x, max(x) + 1e-10)
## 
## > y <- c(min(y) - 1e-10, y, max(y) + 1e-10)
## 
## > fill <- matrix("green3", nrow = nrow(z)-1, ncol = ncol(z)-1)
## 
## > fill[ , i2 <- c(1,ncol(fill))] <- "gray"
## 
## > fill[i1 <- c(1,nrow(fill)) , ] <- "gray"
## 
## > par(bg = "lightblue")
## 
## > persp(x, y, z, theta = 120, phi = 15, col = fill, scale = FALSE, axes = FALSE)

## 
## > title(main = "Maunga Whau\nOne of 50 Volcanoes in the Auckland Region.",
## +       font.main = 4)
## 
## > par(bg = "slategray")
## 
## > persp(x, y, z, theta = 135, phi = 30, col = fill, scale = FALSE,
## +       ltheta = -120, lphi = 15, shade = 0.65, axes = FALSE)

## 
## > ## Don't draw the grid lines :  border = NA
## > persp(x, y, z, theta = 135, phi = 30, col = "green3", scale = FALSE,
## +       ltheta = -120, shade = 0.75, border = NA, box = FALSE)

## 
## > ## `color gradient in the soil' :
## > fcol <- fill ; fcol[] <- terrain.colors(nrow(fcol))
## 
## > persp(x, y, z, theta = 135, phi = 30, col = fcol, scale = FALSE,
## +       ltheta = -120, shade = 0.3, border = NA, box = FALSE)

## 
## > ## `image like' colors on top :
## > fcol <- fill
## 
## > zi <- volcano[ -1,-1] + volcano[ -1,-61] +
## +            volcano[-87,-1] + volcano[-87,-61]  ## / 4
## 
## > fcol[-i1,-i2] <-
## +     terrain.colors(20)[cut(zi,
## +                            stats::quantile(zi, seq(0,1, length.out = 21)),
## +                            include.lowest = TRUE)]
## 
## > persp(x, y, 2*z, theta = 110, phi = 40, col = fcol, scale = FALSE,
## +       ltheta = -120, shade = 0.4, border = NA, box = FALSE)

## 
## > ## reset par():
## > par(oldpar)

Demo data

data()