1) Create the vectors.

x<-c(5,10,15,20,25,30)
y<-c(-1,NA,75,3,5,8)
z<-c(5)

x; y; z
## [1]  5 10 15 20 25 30
## [1] -1 NA 75  3  5  8
## [1] 5

2) Multiply x and y by z.

xz<-x*z
yz<-y*z

xz; yz
## [1]  25  50  75 100 125 150
## [1]  -5  NA 375  15  25  40

3) Replace the missing element of vector y.

y[2]<-2.5

# or

y<-ifelse(test=is.na(y)==T, yes=2.5, no=y)

y
## [1] -1.0  2.5 75.0  3.0  5.0  8.0

4) Load the PRB data and do some stuff.

install.packages("readr", repos = "http://cran.us.r-project.org")
## Installing package into 'C:/Users/Uriel/Documents/R/win-library/3.4'
## (as 'lib' is unspecified)
## package 'readr' successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\Uriel\AppData\Local\Temp\RtmpiysxWL\downloaded_packages
library(readr)

prb<-read_csv(file = "https://raw.githubusercontent.com/coreysparks/data/master/PRB2008_All.csv")
## Parsed with column specification:
## cols(
##   .default = col_integer(),
##   Country = col_character(),
##   Continent = col_character(),
##   Region = col_character(),
##   Population. = col_double(),
##   Rate.of.natural.increase = col_double(),
##   ProjectedPopMid2025 = col_double(),
##   ProjectedPopMid2050 = col_double(),
##   IMR = col_double(),
##   TFR = col_double(),
##   PercPop1549HIVAIDS2001 = col_double(),
##   PercPop1549HIVAIDS2007 = col_double(),
##   PercPpUnderNourished0204 = col_double(),
##   PopDensPerSqMile = col_double()
## )
## See spec(...) for full column specifications.
head(prb, 10)
## # A tibble: 10 x 35
##        Y     X    ID             Country     Continent             Region
##    <int> <int> <int>               <chr>         <chr>              <chr>
##  1     1     1   115         Afghanistan          Asia South Central Asia
##  2     2     2   178             Albania        Europe    Southern Europe
##  3     3     3     1             Algeria        Africa    NORTHERN AFRICA
##  4     4     4   179             Andorra        Europe    Southern Europe
##  5     5     5    43              Angola        Africa      MIDDLE AFRICA
##  6     6     6    67 Antigua and Barbuda North America          Carribean
##  7     7     7    84           Argentina South America      South America
##  8     8     8    97             Armenia          Asia       Western Asia
##  9     9     9   192           Australia       Oceania            Oceania
## 10    10    10   159             Austria        Europe     Western Europe
## # ... with 29 more variables: Year <int>, Population. <dbl>, CBR <int>,
## #   CDR <int>, Rate.of.natural.increase <dbl>, Net.Migration.Rate <int>,
## #   ProjectedPopMid2025 <dbl>, ProjectedPopMid2050 <dbl>,
## #   ProjectedPopChange_08_50Perc <int>, IMR <dbl>,
## #   WomandLifeTimeRiskMaternalDeath <int>, TFR <dbl>, PercPopLT15 <int>,
## #   PercPopGT65 <int>, e0Total <int>, e0Male <int>, e0Female <int>,
## #   PercUrban <int>, PercPopinUrbanGT750k <int>,
## #   PercPop1549HIVAIDS2001 <dbl>, PercPop1549HIVAIDS2007 <dbl>,
## #   PercMarWomContraALL <int>, PercMarWomContraModern <int>,
## #   PercPpUnderNourished0204 <dbl>, MotorVehper1000Pop0005 <int>,
## #   PercPopwAccessImprovedWaterSource <int>,
## #   GNIPPPperCapitaUSDollars <int>, PopDensPerSqKM <int>,
## #   PopDensPerSqMile <dbl>
length(prb$Country)
## [1] 209
summary(prb$Country)
##    Length     Class      Mode 
##       209 character character
summary(prb$e0Total) #There are two NA's in the e0Total variable.
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   33.00   61.50   72.00   67.85   75.00   82.00       2
table(is.na(prb$e0Total),prb$Country) 
##        
##         Afghanistan Albania Algeria Andorra Angola Antigua and Barbuda
##   FALSE           1       1       1       0      1                   1
##   TRUE            0       0       0       1      0                   0
##        
##         Argentina Armenia Australia Austria Azerbaijan Bahamas Bahrain
##   FALSE         1       1         1       1          1       1       1
##   TRUE          0       0         0       0          0       0       0
##        
##         Bangladesh Barbados Belarus Belgium Belize Benin Bhutan Bolivia
##   FALSE          1        1       1       1      1     1      1       1
##   TRUE           0        0       0       0      0     0      0       0
##        
##         Bosnia-Herzegovina Botswana Brazil Brunei Bulgaria Burkina Faso
##   FALSE                  1        1      1      1        1            1
##   TRUE                   0        0      0      0        0            0
##        
##         Burundi        C<U+FFFD>te d'Ivoire Cambodia Cameroon Canada Cape Verde
##   FALSE       1                    1        1        1      1          1
##   TRUE        0                    0        0        0      0          0
##        
##         Central African Republic Chad Channel Islands Chile China
##   FALSE                        1    1               1     1     1
##   TRUE                         0    0               0     0     0
##        
##         China Hong Kong SARe China Macao SARe Colombia Comoros Congo
##   FALSE                    1                1        1       1     1
##   TRUE                     0                0        0       0     0
##        
##         Congo Dem. Rep. Costa Rica Croatia Cuba Cyprus Czech Republic
##   FALSE               1          1       1    1      1              1
##   TRUE                0          0       0    0      0              0
##        
##         Denmark Djibouti Dominica Dominican Republic Ecuador Egypt
##   FALSE       1        1        1                  1       1     1
##   TRUE        0        0        0                  0       0     0
##        
##         El Salvador Equatorial Guinea Eritrea Estonia Ethiopia
##   FALSE           1                 1       1       1        1
##   TRUE            0                 0       0       0        0
##        
##         Federated States of Micronesia Fiji Finland France French Guiana
##   FALSE                              1    1       1      1             1
##   TRUE                               0    0       0      0             0
##        
##         French Polynesia Gabon Gambia Georgia Germany Ghana Greece Grenada
##   FALSE                1     1      1       1       1     1      1       1
##   TRUE                 0     0      0       0       0     0      0       0
##        
##         Guadeloupe Guam Guatemala Guinea Guinea-Bissau Guyana Haiti
##   FALSE          1    1         1      1             1      1     1
##   TRUE           0    0         0      0             0      0     0
##        
##         Honduras Hungary Iceland India Indonesia Iran Iraq Ireland Israel
##   FALSE        1       1       1     1         1    1    1       1      1
##   TRUE         0       0       0     0         0    0    0       0      0
##        
##         Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati Korea North
##   FALSE     1       1     1      1          1     1        1           1
##   TRUE      0       0     0      0          0     0        0           0
##        
##         Korea South Kosovof Kuwait Kyrgyzstan Laos Latvia Lebanon Lesotho
##   FALSE           1       1      1          1    1      1       1       1
##   TRUE            0       0      0          0    0      0       0       0
##        
##         Liberia Libya Liechtenstein Lithuania Luxembourg Macedoniag
##   FALSE       1     1             1         1          1          1
##   TRUE        0     0             0         0          0          0
##        
##         Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands
##   FALSE          1      1        1        1    1     1                1
##   TRUE           0      0        0        0    0     0                0
##        
##         Martinique Mauritania Mauritius Mayotte Mexico Moldova Monaco
##   FALSE          1          1         1       1      1       1      0
##   TRUE           0          0         0       0      0       0      1
##        
##         Mongolia Montenegro Morocco Mozambique Myanmar Namibia Nauru Nepal
##   FALSE        1          1       1          1       1       1     1     1
##   TRUE         0          0       0          0       0       0     0     0
##        
##         Netherlands Netherlands Antilles New Caledonia New Zealand
##   FALSE           1                    1             1           1
##   TRUE            0                    0             0           0
##        
##         Nicaragua Niger Nigeria Norway Oman Pakistan Palau
##   FALSE         1     1       1      1    1        1     1
##   TRUE          0     0       0      0    0        0     0
##        
##         Palestinian Territory Panama Papua New Guinea Paraguay Peru
##   FALSE                     1      1                1        1    1
##   TRUE                      0      0                0        0    0
##        
##         Philippines Poland Portugal Puerto Rico Qatar Reunion Romania
##   FALSE           1      1        1           1     1       1       1
##   TRUE            0      0        0           0     0       0       0
##        
##         Russia Rwanda Saint Lucia Samoa San Marino Sao Tome and Principe
##   FALSE      1      1           1     1          1                     1
##   TRUE       0      0           0     0          0                     0
##        
##         Saudi Arabia Senegal Serbia Seychelles Sierra Leone Singapore
##   FALSE            1       1      1          1            1         1
##   TRUE             0       0      0          0            0         0
##        
##         Slovakia Slovenia Solomon Islands Somalia South Africa Spain
##   FALSE        1        1               1       1            1     1
##   TRUE         0        0               0       0            0     0
##        
##         Sri Lanka St. Kitts-Nevis St. Vincent & the Grenadines Sudan
##   FALSE         1               1                            1     1
##   TRUE          0               0                            0     0
##        
##         Suriname Swaziland Sweden Switzerland Syria Taiwan Tajikistan
##   FALSE        1         1      1           1     1      1          1
##   TRUE         0         0      0           0     0      0          0
##        
##         Tanzania Thailand Timor-Leste Togo Tonga Trinidad and Tobago
##   FALSE        1        1           1    1     1                   1
##   TRUE         0        0           0    0     0                   0
##        
##         Tunisia Turkey Turkmenistan Tuvalu Uganda Ukraine
##   FALSE       1      1            1      1      1       1
##   TRUE        0      0            0      0      0       0
##        
##         United Arab Emirates United Kingdom United States Uruguay
##   FALSE                    1              1             1       1
##   TRUE                     0              0             0       0
##        
##         Uzbekistan Vanuatu Venezuela Vietnam Western Sahara Yemen Zambia
##   FALSE          1       1         1       1              1     1      1
##   TRUE           0       0         0       0              0     0      0
##        
##         Zimbabwe
##   FALSE        1
##   TRUE         0
ifelse(test=is.na(prb$e0Total), yes=prb$Country, no=prb$e0Total) #More compact view but not so compact.
##   [1] "43"      "75"      "72"      "Andorra" "43"      "73"      "75"     
##   [8] "71"      "81"      "80"      "72"      "72"      "75"      "63"     
##  [15] "76"      "70"      "80"      "73"      "56"      "66"      "65"     
##  [22] "74"      "49"      "72"      "75"      "73"      "51"      "49"     
##  [29] "62"      "52"      "80"      "71"      "43"      "47"      "78"     
##  [36] "78"      "73"      "82"      "79"      "72"      "64"      "53"     
##  [43] "53"      "78"      "52"      "76"      "77"      "78"      "77"     
##  [50] "78"      "54"      "75"      "72"      "75"      "72"      "71"     
##  [57] "59"      "57"      "73"      "49"      "67"      "68"      "79"     
##  [64] "81"      "75"      "75"      "57"      "58"      "74"      "79"     
##  [71] "59"      "79"      "68"      "79"      "78"      "69"      "54"     
##  [78] "45"      "65"      "58"      "72"      "73"      "81"      "65"     
##  [85] "70"      "71"      "58"      "79"      "80"      "81"      "72"     
##  [92] "82"      "72"      "66"      "53"      "61"      "71"      "79"     
##  [99] "69"      "78"      "66"      "61"      "72"      "72"      "36"     
## [106] "46"      "73"      "80"      "71"      "80"      "74"      "58"     
## [113] "46"      "74"      "73"      "56"      "79"      "66"      "80"     
## [120] "60"      "72"      "74"      "75"      "69"      "Monaco"  "64"     
## [127] "73"      "70"      "43"      "61"      "47"      "55"      "64"     
## [134] "80"      "75"      "76"      "80"      "71"      "57"      "47"     
## [141] "80"      "74"      "63"      "71"      "72"      "57"      "71"     
## [148] "71"      "69"      "75"      "79"      "78"      "75"      "76"     
## [155] "71"      "67"      "47"      "73"      "73"      "82"      "64"     
## [162] "76"      "62"      "73"      "72"      "48"      "81"      "74"     
## [169] "78"      "62"      "48"      "80"      "71"      "70"      "72"     
## [176] "58"      "69"      "33"      "82"      "73"      "78"      "67"     
## [183] "51"      "72"      "60"      "58"      "71"      "69"      "74"     
## [190] "72"      "62"      "64"      "48"      "68"      "78"      "79"     
## [197] "78"      "76"      "67"      "67"      "73"      "73"      "64"     
## [204] "61"      "38"      "40"      "75"      "50"      "81"