library(rio)
link = "https://github.com/jcgcjuan/Magallanes-Clases-/raw/master/Data%20EconoFreedom.xlsx"
freedom=import(link)
#eliminando columnas 
freedom$CountryID=NULL
freedom$Region=NULL
freedom$`World Rank`=NULL
freedom$`Region Rank`=NULL
freedom$`2019 Score`=NULL
my_na <- is.na(freedom)
#omitiendo NAs
(freedom=na.omit(freedom))
##                                Country Name    Property Rights
## 1                               Afghanistan 19.600000000000001
## 2                                   Albania               54.8
## 3                                   Algeria               31.6
## 4                                    Angola               35.9
## 5                                 Argentina               47.8
## 6                                   Armenia               57.2
## 7                                 Australia 79.099999999999994
## 8                                   Austria               84.2
## 9                                Azerbaijan               59.1
## 10                                  Bahamas               42.2
## 11                                  Bahrain               63.5
## 12                               Bangladesh               36.1
## 13                                 Barbados               52.9
## 14                                  Belarus               55.2
## 15                                  Belgium               81.3
## 16                                   Belize               41.7
## 17                                    Benin 37.200000000000003
## 18                                   Bhutan               62.5
## 19                                  Bolivia               20.5
## 20                   Bosnia and Herzegovina 40.200000000000003
## 21                                 Botswana               58.1
## 22                                   Brazil               57.3
## 23                        Brunei Darussalam                 64
## 24                                 Bulgaria               62.5
## 25                             Burkina Faso               49.1
## 26                                    Burma 34.700000000000003
## 27                                  Burundi               20.6
## 28                                 Cambodia               37.4
## 29                                 Cameroon               42.5
## 30                                   Canada                 87
## 31                               Cabo Verde               44.1
## 32                 Central African Republic 19.600000000000001
## 33                                     Chad               26.7
## 34                                    Chile               68.7
## 35                                    China               49.9
## 36                                 Colombia               59.2
## 37                                  Comoros               36.5
## 38  Congo, Democratic Republic of the Congo               25.3
## 39                       Congo, Republic of 33.200000000000003
## 40                               Costa Rica               58.3
## 41                            CĂ´te d'Ivoire               40.9
## 42                                  Croatia                 66
## 43                                     Cuba               31.6
## 44                                   Cyprus 73.099999999999994
## 45                           Czech Republic               74.8
## 46                                  Denmark               86.2
## 47                                 Djibouti               29.7
## 48                                 Dominica               49.2
## 49                       Dominican Republic               50.6
## 50                                  Ecuador               35.9
## 51                                    Egypt                 37
## 52                              El Salvador               37.6
## 53                        Equatorial Guinea               29.7
## 54                                  Eritrea               35.5
## 55                                  Estonia               81.5
## 56                                 Eswatini               41.7
## 57                                 Ethiopia               32.6
## 58                                     Fiji               67.3
## 59                                  Finland               89.6
## 60                                   France               82.5
## 61                                    Gabon               28.1
## 62                                   Gambia               39.9
## 63                                  Georgia 65.900000000000006
## 64                                  Germany 79.900000000000006
## 65                                    Ghana               49.1
## 66                                   Greece               52.4
## 67                                Guatemala 40.299999999999997
## 68                                   Guinea 34.700000000000003
## 69                            Guinea-Bissau               32.6
## 70                                   Guyana               41.7
## 71                                    Haiti               10.4
## 72                                 Honduras               43.4
## 73                                Hong Kong               93.3
## 74                                  Hungary               60.9
## 75                                  Iceland               87.4
## 76                                    India               57.3
## 77                                Indonesia               52.2
## 78                                     Iran               33.5
## 79                                     Iraq                 37
## 80                                  Ireland               85.8
## 81                                   Israel                 80
## 82                                    Italy               71.7
## 83                                  Jamaica               60.7
## 84                                    Japan               84.1
## 85                                   Jordan               58.4
## 86                               Kazakhstan               59.3
## 87                                    Kenya               53.8
## 88                                 Kiribati               44.1
## 89                             Korea, North               31.6
## 90                             Korea, South               79.3
## 91                                   Kosovo               57.2
## 92                                   Kuwait               52.9
## 93                          Kyrgyz Republic               49.9
## 94                                     Laos 38.799999999999997
## 95                                   Latvia               67.3
## 96                                  Lebanon               39.5
## 97                                  Lesotho               41.5
## 98                                  Liberia               26.7
## 99                                    Libya                7.6
## 100                           Liechtenstein                N/A
## 101                               Lithuania 73.599999999999994
## 102                              Luxembourg                 83
## 103                                   Macau                 60
## 104                               Macedonia 65.099999999999994
## 105                              Madagascar 33.200000000000003
## 106                                  Malawi 35.799999999999997
## 107                                Malaysia               84.1
## 108                                Maldives               43.9
## 109                                    Mali 33.700000000000003
## 110                                   Malta               69.8
## 111                              Mauritania               27.5
## 112                               Mauritius               69.5
## 113                                  Mexico               59.1
## 114                              Micronesia                7.6
## 115                                 Moldova               55.2
## 116                                Mongolia               48.2
## 117                              Montenegro               55.4
## 118                                 Morocco               57.2
## 119                              Mozambique               33.9
## 120                                 Namibia               55.9
## 121                                   Nepal 39.200000000000003
## 122                             Netherlands                 88
## 123                             New Zealand                 95
## 124                               Nicaragua               33.4
## 125                                   Niger 37.200000000000003
## 126                                 Nigeria               36.5
## 127                                  Norway               86.1
## 128                                    Oman               58.1
## 129                                Pakistan               41.5
## 130                                  Panama               60.4
## 131                        Papua New Guinea               37.4
## 132                                Paraguay               39.5
## 133                                    Peru               56.1
## 134                             Philippines               48.7
## 135                                  Poland               62.3
## 136                                Portugal               71.5
## 137                                   Qatar               64.5
## 138                                 Romania               66.7
## 139                                  Russia               52.4
## 140                                  Rwanda               72.2
## 141                             Saint Lucia 65.900000000000006
## 142        Saint Vincent and the Grenadines               36.5
## 143                                   Samoa               53.8
## 144                   SĂ£o TomĂ© and PrĂ­ncipe               37.4
## 145                            Saudi Arabia                 55
## 146                                 Senegal               47.8
## 147                                  Serbia               50.1
## 148                              Seychelles               58.2
## 149                            Sierra Leone               35.5
## 150                               Singapore               97.4
## 151                                Slovakia               68.5
## 152                                Slovenia 76.400000000000006
## 153                         Solomon Islands               49.9
## 154                                 Somalia 33.700000000000003
## 155                            South Africa               58.8
## 156                                   Spain 72.900000000000006
## 157                               Sri Lanka               44.7
## 158                                   Sudan               27.5
## 159                                Suriname               49.1
## 160                                  Sweden               89.5
## 161                             Switzerland               85.3
## 162                                   Syria                 37
## 163                                  Taiwan               85.4
## 164                              Tajikistan               47.8
## 165                                Tanzania               35.4
## 166                                Thailand               53.7
## 167                             Timor-Leste               29.7
## 168                                    Togo               35.5
## 169                                   Tonga               59.2
## 170                     Trinidad and Tobago               52.3
## 171                                 Tunisia               49.2
## 172                                  Turkey               55.8
## 173                            Turkmenistan               31.6
## 174                                  Uganda               42.2
## 175                                 Ukraine               43.9
## 176                    United Arab Emirates               81.8
## 177                          United Kingdom               92.3
## 178                           United States               79.3
## 179                                 Uruguay               68.3
## 180                              Uzbekistan               49.8
## 181                                 Vanuatu 65.900000000000006
## 182                               Venezuela                7.6
## 183                                 Vietnam               49.8
## 184                                   Yemen 19.600000000000001
## 185                                  Zambia                 45
## 186                                Zimbabwe               29.7
##     Judical Effectiveness Government Integrity         Tax Burden
## 1                    29.6                 25.2               91.7
## 2                    30.6                 40.4               86.3
## 3      36.200000000000003                 28.9 76.400000000000006
## 4                    26.6                 20.5               83.9
## 5                    44.5                 33.5               69.3
## 6                    46.3                 38.6               84.7
## 7                    86.5   79.900000000000006               62.8
## 8                    71.3   77.400000000000006               50.5
## 9                    53.1                 44.7               87.5
## 10                   46.9                 43.7               97.3
## 11                   50.7                 53.6               99.7
## 12                   34.5                 24.4               72.7
## 13                   59.9                 53.8 70.099999999999994
## 14                   51.7   37.700000000000003               89.4
## 15                   61.6                 72.5               47.1
## 16                   46.9                 27.2 79.900000000000006
## 17     32.799999999999997                 28.1               69.3
## 18                   55.4                 54.5                 83
## 19                   12.3                 19.7               82.4
## 20                   37.9                 30.2               84.3
## 21                   45.7                 52.4               82.7
## 22                   51.7                 28.1               70.5
## 23                     56                 43.7               90.7
## 24                   41.9                 35.1               90.2
## 25                   42.9                 36.6 81.900000000000006
## 26     18.100000000000001                 30.6               86.6
## 27                     31                 26.2                 74
## 28                   27.6                 16.7               89.7
## 29                   31.3                 25.5 74.400000000000006
## 30     69.400000000000006                 84.6               76.8
## 31                     49                 43.7 76.400000000000006
## 32                   29.6                 23.2               65.2
## 33                   24.6                 23.2               46.1
## 34                   56.3                 62.3               77.3
## 35                   75.2                 49.1 70.400000000000006
## 36     34.299999999999997                 33.5               74.3
## 37                   29.6                 24.4               63.9
## 38                   30.7                 26.2               73.8
## 39                   29.6                 25.3               59.5
## 40                     54                 54.5               79.2
## 41                   47.8                 38.1               77.5
## 42                   42.9                 38.6 66.400000000000006
## 43                     10   37.700000000000003               48.8
## 44                   48.1                 43.7 74.900000000000006
## 45                   47.6                 52.1               82.6
## 46                   77.8                 85.8                 42
## 47     18.100000000000001                 28.1               76.2
## 48                   63.8                 54.5 72.099999999999994
## 49     18.100000000000001                 23.2               84.6
## 50                   20.2                 25.3                 77
## 51                   48.3                 29.2               85.2
## 52                   29.1                 23.4 78.099999999999994
## 53     18.100000000000001                 15.8               71.3
## 54     18.100000000000001                 19.7 81.400000000000006
## 55                     76   73.099999999999994 79.900000000000006
## 56                   42.9                   35               74.8
## 57                   40.9                 35.1               77.2
## 58                   42.9                 23.4 81.099999999999994
## 59                   81.2                 92.5               66.8
## 60     66.099999999999994   67.900000000000006               48.4
## 61                   30.6                 35.5               75.8
## 62                   42.5                 41.2               74.3
## 63                   54.6                 58.5               87.1
## 64     75.400000000000006                 81.3               60.8
## 65                   44.2                 35.5               78.8
## 66                   49.5   37.700000000000003               59.1
## 67     32.299999999999997                 26.4               79.2
## 68                   32.6                 25.5 69.400000000000006
## 69                   42.9                 25.3               88.8
## 70                   42.9   33.200000000000003                 67
## 71                   25.3                 20.3 79.900000000000006
## 72                     31                 25.3               82.8
## 73                   75.3                 83.8               93.1
## 74                   45.2   35.299999999999997 78.599999999999994
## 75                   63.8                 83.8               72.7
## 76                   61.6                 47.8 79.400000000000006
## 77                   53.5                 39.5               83.7
## 78                   41.3                   35 80.900000000000006
## 79                   12.3                 20.3                N/A
## 80     68.400000000000006                   78               76.3
## 81     73.400000000000006   67.900000000000006               61.9
## 82                   49.8                 43.7               55.6
## 83                   49.2                   45               80.2
## 84                   68.5                   78               68.2
## 85                   52.6                 50.3               91.4
## 86                   56.1   40.299999999999997               93.4
## 87                   46.9                 32.1               79.5
## 88     34.299999999999997                 35.1                 73
## 89                      5                 24.4                  0
## 90                   57.5                 50.5               64.2
## 91                   53.5                 44.7               92.5
## 92                   43.3   35.299999999999997               97.7
## 93                   27.9                 27.2               94.1
## 94                   42.5                 33.5               86.9
## 95                   48.4                 35.5                 77
## 96                   26.6                 18.2               91.8
## 97                   45.7                 30.9               59.4
## 98                     39                 24.2               82.7
## 99                   24.4                 15.8                N/A
## 100                   N/A                  N/A                N/A
## 101                  61.2                 47.8               86.4
## 102    72.400000000000006                 85.8 65.400000000000006
## 103                    60   33.200000000000003 77.099999999999994
## 104                  60.7                 44.7               91.8
## 105                  24.4                 14.3                 91
## 106                  40.1                 25.2               79.8
## 107                  68.2                 55.4               85.6
## 108                  36.4                 33.5               95.8
## 109                  33.4                 29.6               68.7
## 110                  50.4                 50.3               64.2
## 111                  30.6                 30.6                 78
## 112                  62.1   40.299999999999997               92.1
## 113                  34.9                 26.3               75.8
## 114                  26.6                 36.6               92.8
## 115                  29.6                 25.4               85.4
## 116                  23.8                 29.8               88.5
## 117                  51.8                 39.5               85.3
## 118                  47.1   39.200000000000003               72.2
## 119    35.200000000000003                 28.1               75.5
## 120                  54.7                 49.8               66.5
## 121    34.700000000000003                 26.2                 84
## 122                  74.7                 89.1               51.6
## 123                  83.5                 96.7                 71
## 124                  18.7                 20.3 76.900000000000006
## 125                    31                 34.1 76.900000000000006
## 126    34.299999999999997                 20.5                 85
## 127                  81.2                 92.3               57.4
## 128                  51.6                 53.8               97.8
## 129    40.200000000000003                 30.6               80.5
## 130                  30.1                 34.1                 85
## 131                    49   37.200000000000003               71.8
## 132                    30                 25.5               96.3
## 133                    34                 31.8 80.599999999999994
## 134                  36.4                 30.9 76.900000000000006
## 135                    44                 49.8 74.900000000000006
## 136                  64.3                 59.5               59.9
## 137                    60   77.400000000000006               99.7
## 138                  51.9   39.799999999999997               89.7
## 139                  45.1                 36.6               89.4
## 140                  83.2   67.900000000000006               79.8
## 141                  63.8                 50.3               76.2
## 142                  63.8                 50.5               71.2
## 143                    31   37.700000000000003 79.900000000000006
## 144                  26.6                 35.5               87.2
## 145                  62.7                 49.8               99.8
## 146                  40.4   40.299999999999997               70.8
## 147                  44.8   37.200000000000003                 82
## 148                  37.5   39.200000000000003               76.3
## 149                  34.5                 26.2               87.3
## 150                  92.4                 95.1               90.4
## 151    37.200000000000003   37.700000000000003 78.599999999999994
## 152                  46.5                 53.6               58.4
## 153                  51.7                 33.5               65.5
## 154                  26.6                  7.9                N/A
## 155    39.299999999999997   39.700000000000003               62.1
## 156                  51.4                 51.9               62.3
## 157                  39.4                 28.9               84.9
## 158                  22.2                 26.2               86.3
## 159                  22.2                 35.5 70.900000000000006
## 160                    84                   88               43.2
## 161                    82                   88               70.5
## 162                  24.4                 20.3                N/A
## 163    70.099999999999994                 69.2                 75
## 164                  52.1                 36.4               91.8
## 165                  41.4   33.200000000000003               80.5
## 166                  45.9                 36.4               81.3
## 167                  13.1                 32.1               96.3
## 168                  29.6                 28.1               67.8
## 169                  26.6                 38.1               85.5
## 170                  40.6                 32.9               82.3
## 171                  42.7                 36.6 74.400000000000006
## 172                  49.8                 41.2 76.400000000000006
## 173                  29.8                 20.3               95.9
## 174                  38.5                 25.4               73.3
## 175                  31.5                 29.6               81.8
## 176                  87.1                 78.8               99.2
## 177                  85.9                 83.8               64.7
## 178    78.599999999999994   77.400000000000006 75.099999999999994
## 179                  58.9                 69.2               77.2
## 180    34.299999999999997                 25.2               91.3
## 181                  36.4                 51.9               97.3
## 182                  13.1                  7.9               74.7
## 183    40.299999999999997                   34               79.7
## 184                  22.2                 20.3                N/A
## 185                  35.6   32.299999999999997               72.3
## 186                  24.8                 15.8               62.3
##         Gov't Spending      Fiscal Health   Business Freedom      Labor Freedom
## 1                 80.3               99.3               49.2               60.4
## 2   73.900000000000006 80.599999999999994               69.3               52.7
## 3                 48.7               18.7               61.6               49.9
## 4                 80.7               58.2               55.7               58.8
## 5                 49.5                 33               56.4               46.9
## 6                   79                 53               78.3 71.400000000000006
## 7                 60.1               86.2               88.3               84.1
## 8                 24.5               85.5 74.900000000000006               68.7
## 9                 59.5               89.4               69.5               63.9
## 10                86.8               65.7               68.5               67.5
## 11                62.7                3.7 71.400000000000006 71.099999999999994
## 12                94.5 77.599999999999994               50.9               68.2
## 13                  65               79.5               69.8               59.9
## 14                41.3               85.4                 75               75.3
## 15                15.2 73.400000000000006 78.099999999999994                 61
## 16  65.900000000000006               39.1               61.8               54.8
## 17                83.4               27.9               62.4               53.8
## 18  71.599999999999994 77.599999999999994               68.7               79.5
## 19                49.3 17.600000000000001               58.8               52.9
## 20                46.1               96.6               49.7                 67
## 21  65.900000000000006               94.6               68.7               68.2
## 22                55.2                5.9               57.9               51.9
## 23                59.9                 20               80.2               90.8
## 24                63.9               98.8               62.7 68.400000000000006
## 25                  80               61.8               51.6               52.3
## 26                85.4               78.3               52.8               65.7
## 27                83.3               23.3               50.3               67.5
## 28                85.9               89.1               29.9                 63
## 29                87.5               58.4               44.4               47.8
## 30                51.3               83.1 81.900000000000006               73.7
## 31                71.2               59.7               65.2               55.7
## 32                94.2               94.3               24.2               40.1
## 33                92.4               85.2               28.1               43.2
## 34                  81                 89 76.599999999999994                 65
## 35  70.099999999999994                 76               56.2               64.2
## 36                  75               79.2 71.400000000000006               78.5
## 37  73.400000000000006               91.7               57.2               60.3
## 38                93.9               96.9               53.2               41.9
## 39                40.6                  0 38.200000000000003 35.799999999999997
## 40                88.4               42.5               67.2               55.2
## 41                83.9               74.3                 61               52.5
## 42                33.4               85.4               60.7                 44
## 43                   0               15.6                 20                 20
## 44                55.2               80.3 76.900000000000006               59.5
## 45                52.1               97.6 72.400000000000006 78.099999999999994
## 46                14.4               96.7               90.7               86.4
## 47                27.3 18.100000000000001               54.7               60.4
## 48                53.5               84.7               70.7               60.4
## 49                90.3               89.9               51.9               57.6
## 50                55.5               32.1               54.1               48.2
## 51  68.099999999999994                  0 65.900000000000006               51.6
## 52                86.3 81.900000000000006               57.2               53.1
## 53  67.599999999999994 16.399999999999999               37.6 32.700000000000003
## 54  73.900000000000006                  0               17.7                 70
## 55                51.1               99.8               75.3               57.2
## 56  65.599999999999994               18.3               59.2               67.5
## 57                90.4               83.3               48.6                 58
## 58                71.7               82.4                 63 72.900000000000006
## 59                 7.2               86.4               89.4               50.3
## 60                 3.9 64.900000000000006               81.2               45.2
## 61                86.6               82.1               52.1                 53
## 62                70.7                  0                 54 67.400000000000006
## 63  73.599999999999994               93.9               85.8 76.599999999999994
## 64                42.3               91.8               83.3               52.8
## 65                  82               23.9               56.5               59.9
## 66                23.3                 79 74.099999999999994               52.5
## 67                95.6               96.2               53.6               48.7
## 68                89.8               87.2               54.6               54.9
## 69                86.7 81.400000000000006               35.9               61.2
## 70  69.400000000000006 77.599999999999994               59.3                 62
## 71                88.3               95.9 36.200000000000003               62.6
## 72                78.2               95.9               56.9                 32
## 73                90.3                100               96.4               89.2
## 74                31.7                 85               61.1               64.7
## 75                  44               96.7               88.4 64.099999999999994
## 76                77.3               14.7               57.1               41.8
## 77                91.4               88.1               69.3               49.3
## 78                89.8               89.5               62.2               50.7
## 79                52.8               13.3               54.4               53.1
## 80  77.400000000000006                 89               83.1               75.3
## 81                52.4               85.3 71.400000000000006 65.099999999999994
## 82                26.5               71.3               71.7               51.1
## 83                  76                 80                 78 73.599999999999994
## 84                  55               55.7               80.5                 79
## 85  73.400000000000006               60.6               61.8               52.7
## 86                83.7                 41 73.900000000000006               86.2
## 87                77.8               13.8               55.8               63.4
## 88                   0               98.6               41.9               50.7
## 89                   0                  0                  5                  5
## 90  68.599999999999994               96.8               91.3               57.4
## 91                77.7                 96               73.8 64.900000000000006
## 92                17.3               99.1               57.4               61.7
## 93                54.2 78.400000000000006 73.400000000000006               79.8
## 94                85.3               66.5               60.1               60.1
## 95                57.1               96.9               77.5               73.3
## 96  75.599999999999994                  0               47.9               46.5
## 97                  33               63.5               53.3               58.8
## 98                62.1 69.099999999999994               50.6 38.299999999999997
## 99                   0                 20 40.200000000000003               51.3
## 100                N/A                N/A                N/A                N/A
## 101 65.099999999999994               97.3               75.2               63.6
## 102               46.6               98.9               68.8               45.9
## 103               90.4                100                 60                 50
## 104                 70               82.9               80.2               71.5
## 105               91.8               85.5               47.3               44.6
## 106               70.3 19.100000000000001               41.7                 64
## 107               83.2               82.4               83.9 74.400000000000006
## 108               60.8               10.7               78.3               70.8
## 109               85.4               84.2               53.8               52.2
## 110               56.1               94.5 67.099999999999994               61.3
## 111               74.2 80.599999999999994               61.9               51.5
## 112               80.3 73.599999999999994               79.8               60.8
## 113               78.2               83.2               67.8               58.6
## 114                  0               98.8               57.4 71.900000000000006
## 115               59.1                 92                 67                 39
## 116               63.1                6.2                 66                 75
## 117               32.6               23.2               73.3 73.400000000000006
## 118               72.7 66.900000000000006               70.3               33.1
## 119 66.900000000000006 16.600000000000001               57.1                 42
## 120               48.9               15.7               65.8               85.1
## 121               83.7               98.5               61.8               47.9
## 122               42.9               93.3 81.400000000000006               60.3
## 123               50.4               98.6                 91               86.7
## 124 79.099999999999994               93.9                 56               55.8
## 125 75.599999999999994               22.2               56.3               48.2
## 126               96.5               68.2               51.2               83.3
## 127               25.3               97.3               89.4               53.7
## 128               32.5 16.100000000000001               75.2               57.3
## 129               87.6               49.2               56.1               41.8
## 130               85.3               91.3 73.599999999999994               43.4
## 131               89.1               75.2               62.2 72.599999999999994
## 132 78.900000000000006               96.3               61.5               29.2
## 133               86.1               88.5               67.8               63.5
## 134               88.7               97.1               61.3               57.9
## 135               48.8               86.4 65.400000000000006               63.9
## 136               35.6               69.8               79.7               44.3
## 137               56.8                 94               71.2 65.900000000000006
## 138                 69               89.3               63.1               64.5
## 139               62.3               86.6 78.400000000000006               52.5
## 140 79.400000000000006               86.3               56.2               82.2
## 141               79.3               81.3               76.3               69.2
## 142               74.3                 85               76.5               73.5
## 143               62.3               93.6                 77               78.2
## 144                 67               62.3 65.099999999999994               42.7
## 145               57.5 19.399999999999999               72.3               63.3
## 146               73.3                 60               53.3               39.4
## 147               45.1               90.1 72.900000000000006 67.400000000000006
## 148               60.3                 92               63.3               63.2
## 149               84.4               13.2               44.9               29.3
## 150               90.7                 80               90.8                 91
## 151               46.1               87.2               61.3               53.4
## 152 38.299999999999997               82.6               79.3               61.2
## 153               36.5               89.4 68.599999999999994                 72
## 154                N/A                N/A               31.7                N/A
## 155 67.599999999999994               62.6               64.3               59.1
## 156               46.2               51.1               66.8               57.8
## 157               88.3               30.4 75.099999999999994               58.8
## 158               96.6 76.099999999999994               52.1                 59
## 159               77.2                9.6               48.3               73.5
## 160               26.7               96.6                 88               53.9
## 161               64.8               96.3 75.400000000000006               72.5
## 162                N/A                N/A               49.6               58.2
## 163               90.6               91.6               93.2               60.9
## 164 64.599999999999994               60.3               67.3               49.2
## 165               90.3               85.2               46.6               66.2
## 166               85.8               96.5               82.5               63.9
## 167                0.9                 20               60.5               58.8
## 168                 77               24.5               50.4               46.7
## 169               40.9               93.4               75.3 69.900000000000006
## 170               61.9 16.600000000000001               67.8 75.599999999999994
## 171 74.400000000000006               37.9               76.7               50.3
## 172 65.099999999999994               92.2                 66               49.2
## 173                 92               92.3                 30                 20
## 174               88.7 68.599999999999994               46.3               83.2
## 175               46.9               82.6 66.099999999999994               46.7
## 176               68.8               88.9 79.900000000000006 81.099999999999994
## 177               48.2 68.599999999999994               92.9               73.5
## 178               57.1               53.1               83.8               89.4
## 179               67.5 69.900000000000006               74.3 71.900000000000006
## 180 67.400000000000006               98.7               72.5               58.7
## 181               54.1               15.3               52.4               58.8
## 182               58.1 17.600000000000001               33.9                 28
## 183 74.099999999999994 40.700000000000003               63.5               62.8
## 184               83.7                  0               45.1               49.8
## 185 80.099999999999994               12.3 71.099999999999994                 46
## 186               74.5               23.7               33.4               43.3
##       Monetary Freedom      Trade Freedom Investment Freedom Financial Freedom
## 1                 76.7                 66                 10                10
## 2                 81.5               87.8                 70                70
## 3   74.900000000000006 67.400000000000006                 30                30
## 4                 55.4               61.2                 30                40
## 5                 60.2                 70                 55                60
## 6                 77.8               80.8                 75                70
## 7                 86.6               87.6                 80                90
## 8                 81.5                 86                 90                70
## 9                   63 74.599999999999994                 60                60
## 10  78.099999999999994               47.8                 50                60
## 11  81.599999999999994               83.8                 75                80
## 12  69.900000000000006               63.6                 45                30
## 13                78.3               56.6                 70                60
## 14                  67 76.400000000000006                 30                10
## 15  76.099999999999994                 86                 85                70
## 16                78.7                 64                 55                50
## 17                86.4               61.8                 70                50
## 18  72.599999999999994 79.400000000000006                 20                30
## 19                68.8 70.400000000000006                 15                40
## 20                83.1               82.6                 65                60
## 21                78.8               83.8                 65                70
## 22                75.5                 69                 50                50
## 23                76.5                 84                 65                50
## 24                  88                 86                 70                60
## 25                86.2               65.2                 65                40
## 26  69.599999999999994               70.8                 30                20
## 27                62.2               68.2                 50                30
## 28  79.400000000000006 65.400000000000006                 60                50
## 29                  84               53.4                 30                50
## 30                77.2               86.8                 80                80
## 31                84.1               68.2                 80                60
## 32                72.3                 51                 45                30
## 33                82.3               47.2                 60                40
## 34                84.5               88.8                 85                70
## 35  71.900000000000006                 73                 25                20
## 36  75.599999999999994                 76                 80                70
## 37                82.8                 70                 45                30
## 38                49.1               62.6                 30                20
## 39                82.6               56.8                 45                30
## 40                83.2 81.400000000000006                 70                50
## 41                74.2 73.599999999999994                 75                50
## 42                78.5                 86                 75                60
## 43  65.599999999999994                 64                 10                10
## 44                  84                 86                 75                60
## 45                81.5                 86                 80                80
## 46                84.1                 86                 90                80
## 47                72.7               50.4                 80                50
## 48                85.7               68.2                 70                30
## 49                79.7               75.8                 70                40
## 50                73.5 66.400000000000006                 35                40
## 51                62.3               71.8                 60                50
## 52                  79 81.400000000000006                 75                60
## 53                83.7               48.8                 40                30
## 54                  61               69.2                  0                20
## 55  79.599999999999994                 86                 90                70
## 56                73.7               87.6                 50                40
## 57                60.8               60.8                 35                20
## 58                73.5               62.8                 55                50
## 59                84.8                 86                 85                80
## 60  79.099999999999994                 81                 75                70
## 61                  80               51.2                 60                40
## 62                62.4               61.6                 65                50
## 63                  76               88.6                 80                70
## 64  77.900000000000006                 86                 80                70
## 65                66.3               63.4                 70                60
## 66  79.099999999999994                 81                 55                50
## 67                  77               82.2                 70                50
## 68  66.400000000000006               63.2                 50                40
## 69  78.099999999999994               55.6                 30                30
## 70  76.900000000000006               66.8                 55                30
## 71                66.5                 72                 45                30
## 72                  73 79.400000000000006                 65                60
## 73                86.4                 95                 90                90
## 74                81.8                 86                 80                70
## 75                81.7                 87                 85                70
## 76  72.400000000000006 72.400000000000006                 40                40
## 77  77.400000000000006               79.8                 45                60
## 78                60.1               54.6                  5                10
## 79  81.400000000000006                N/A                N/A               N/A
## 80                  87                 86                 90                70
## 81                86.2               84.4                 75                70
## 82                  84                 86                 85                50
## 83                82.6 68.400000000000006                 80                50
## 84                85.9                 80                 70                60
## 85                  85 81.400000000000006                 70                60
## 86  70.900000000000006                 80                 50                50
## 87                72.7               60.4                 55                50
## 88  81.099999999999994               53.2                 25                30
## 89                   0                  0                  0                 0
## 90                  82 80.400000000000006                 70                70
## 91                78.3               70.8                 65                30
## 92  70.599999999999994                 79                 55                60
## 93  74.400000000000006 78.599999999999994                 60                50
## 94                78.5               81.8                 35                20
## 95  81.099999999999994                 86                 85                60
## 96  78.099999999999994                 79                 60                50
## 97                  75                 81                 55                40
## 98  68.900000000000006               60.1                 55                20
## 99                52.8                N/A                  5               N/A
## 100                N/A                N/A                 85                80
## 101               84.6                 86                 80                70
## 102               82.6                 86                 95                80
## 103               76.5                 90                 85                70
## 104               78.7                 82                 65                60
## 105 72.400000000000006               69.2                 55                50
## 106               65.5 75.400000000000006                 50                50
## 107 78.599999999999994                 82                 60                50
## 108                 81               62.6                 35                30
## 109 81.599999999999994               69.8                 65                40
## 110               78.2                 86                 85                60
## 111               81.2               62.6                 50                40
## 112 79.400000000000006               88.4                 80                70
## 113 75.900000000000006 81.400000000000006                 75                60
## 114               85.8 80.599999999999994                 35                30
## 115               73.5                 78                 55                50
## 116               77.8               75.8                 50                60
## 117 81.599999999999994               84.7                 75                50
## 118               83.5 77.400000000000006                 65                70
## 119 65.400000000000006                 78                 35                50
## 120 74.400000000000006                 83                 65                40
## 121 69.400000000000006               60.4                 10                30
## 122                 84                 86                 90                80
## 123               87.5               92.4                 80                80
## 124               72.7                 76                 60                50
## 125               76.7               65.8                 55                40
## 126                 65               62.4                 45                40
## 127 75.400000000000006               83.2                 75                60
## 128               77.7                 87                 65                60
## 129 72.599999999999994               64.8                 55                40
## 130 79.400000000000006               79.2                 75                70
## 131                 70 80.900000000000006                 25                30
## 132               72.8 76.599999999999994                 75                60
## 133               83.9               86.4                 75                60
## 134 69.599999999999994               78.2                 60                60
## 135               82.1                 86                 80                70
## 136                 83                 86                 70                60
## 137 78.400000000000006               83.2                 60                60
## 138               82.7                 86                 70                50
## 139 65.099999999999994               77.8                 30                30
## 140 76.099999999999994 70.400000000000006                 60                40
## 141               83.9               73.2                 65                40
## 142               82.2 66.599999999999994                 70                40
## 143               83.5               63.8                 55                30
## 144               70.5               64.2                 60                30
## 145 78.099999999999994                 76                 45                50
## 146               78.2                 72                 60                40
## 147                 80                 77                 70                50
## 148                 80 81.400000000000006                 55                30
## 149                 65 69.400000000000006                 60                20
## 150               85.3               94.8                 85                80
## 151 78.599999999999994                 86                 75                70
## 152               83.6                 86                 70                50
## 153                 86               56.8                 15                30
## 154                N/A                N/A                N/A               N/A
## 155               75.2                 76                 45                50
## 156               87.5                 86                 85                70
## 157 70.099999999999994               76.2                 40                40
## 158               56.9                 45                  5                20
## 159                 56 64.599999999999994                 40                30
## 160                 82                 86                 85                80
## 161               85.2               87.4                 85                90
## 162               48.3                 47                  0               N/A
## 163               84.4                 87                 60                60
## 164               68.5 73.599999999999994                 25                30
## 165 70.400000000000006               67.8                 55                50
## 166               75.2                 83                 55                60
## 167               79.5                 75                 45                20
## 168 79.099999999999994 69.400000000000006                 65                30
## 169 69.400000000000006 73.599999999999994                 40                20
## 170 75.099999999999994 68.400000000000006                 60                50
## 171                 76 71.400000000000006                 45                30
## 172                 70 79.599999999999994                 70                60
## 173 73.400000000000006                 76                 10                10
## 174 80.099999999999994 75.400000000000006                 55                40
## 175               58.6                 75                 35                30
## 176 80.900000000000006               84.4                 40                60
## 177               81.2                 86                 90                80
## 178 76.599999999999994               86.6                 85                80
## 179 72.900000000000006 78.599999999999994                 85                30
## 180               58.9               62.6                 10                10
## 181                 75 64.400000000000006                 65                40
## 182                  0                 60                  0                10
## 183 68.900000000000006               79.2                 30                40
## 184               61.5 71.400000000000006                 50               N/A
## 185               70.3 72.599999999999994                 55                50
## 186 72.400000000000006                 70                 25                10
#cambiando a numerico
str(freedom)
## 'data.frame':    186 obs. of  13 variables:
##  $ Country Name         : chr  "Afghanistan" "Albania" "Algeria" "Angola" ...
##  $ Property Rights      : chr  "19.600000000000001" "54.8" "31.6" "35.9" ...
##  $ Judical Effectiveness: chr  "29.6" "30.6" "36.200000000000003" "26.6" ...
##  $ Government Integrity : chr  "25.2" "40.4" "28.9" "20.5" ...
##  $ Tax Burden           : chr  "91.7" "86.3" "76.400000000000006" "83.9" ...
##  $ Gov't Spending       : chr  "80.3" "73.900000000000006" "48.7" "80.7" ...
##  $ Fiscal Health        : chr  "99.3" "80.599999999999994" "18.7" "58.2" ...
##  $ Business Freedom     : chr  "49.2" "69.3" "61.6" "55.7" ...
##  $ Labor Freedom        : chr  "60.4" "52.7" "49.9" "58.8" ...
##  $ Monetary Freedom     : chr  "76.7" "81.5" "74.900000000000006" "55.4" ...
##  $ Trade Freedom        : chr  "66" "87.8" "67.400000000000006" "61.2" ...
##  $ Investment Freedom   : chr  "10" "70" "30" "30" ...
##  $ Financial Freedom    : chr  "10" "70" "30" "40" ...
freedom[,c(2:12)]=lapply(freedom[,c(2:12)],as.numeric)
## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion

## Warning in lapply(freedom[, c(2:12)], as.numeric): NAs introduced by coercion
str(freedom)
## 'data.frame':    186 obs. of  13 variables:
##  $ Country Name         : chr  "Afghanistan" "Albania" "Algeria" "Angola" ...
##  $ Property Rights      : num  19.6 54.8 31.6 35.9 47.8 57.2 79.1 84.2 59.1 42.2 ...
##  $ Judical Effectiveness: num  29.6 30.6 36.2 26.6 44.5 46.3 86.5 71.3 53.1 46.9 ...
##  $ Government Integrity : num  25.2 40.4 28.9 20.5 33.5 38.6 79.9 77.4 44.7 43.7 ...
##  $ Tax Burden           : num  91.7 86.3 76.4 83.9 69.3 84.7 62.8 50.5 87.5 97.3 ...
##  $ Gov't Spending       : num  80.3 73.9 48.7 80.7 49.5 79 60.1 24.5 59.5 86.8 ...
##  $ Fiscal Health        : num  99.3 80.6 18.7 58.2 33 53 86.2 85.5 89.4 65.7 ...
##  $ Business Freedom     : num  49.2 69.3 61.6 55.7 56.4 78.3 88.3 74.9 69.5 68.5 ...
##  $ Labor Freedom        : num  60.4 52.7 49.9 58.8 46.9 71.4 84.1 68.7 63.9 67.5 ...
##  $ Monetary Freedom     : num  76.7 81.5 74.9 55.4 60.2 77.8 86.6 81.5 63 78.1 ...
##  $ Trade Freedom        : num  66 87.8 67.4 61.2 70 80.8 87.6 86 74.6 47.8 ...
##  $ Investment Freedom   : num  10 70 30 30 55 75 80 90 60 50 ...
##  $ Financial Freedom    : chr  "10" "70" "30" "40" ...
row.names(freedom)=freedom$Country
freedom=na.omit(freedom)
library(cluster)

g.dist = daisy(freedom[,c(2:12)], metric="gower")
pam.resultado=pam(g.dist,4,cluster.only = F)

freedom$clusterPT=pam.resultado$cluster
library(factoextra)
## Loading required package: ggplot2
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
fviz_cluster(object = list(data=g.dist, cluster = freedom$clusterPT),
             geom = c("text"), 
             ellipse.type = "convex")

fviz_nbclust(freedom[,c(2:12)], pam,diss=g.dist,method = "gap_stat",k.max = 10,verbose = F)

#Respuesta: Si es optimo usar cuatro clusters

res.pam = pam(g.dist,4,cluster.only = F)
fviz_silhouette(res.pam)
##   cluster size ave.sil.width
## 1       1   41          0.29
## 2       2   68          0.19
## 3       3   43          0.14
## 4       4   28          0.37

#Respuesta: b) Se podrĂ­a intentar analizar mediante otras tecnicas como la jerarquica para saber si la silueta es menor