##Part A: AirPassengers

data(AirPassengers) 
AirPassengers 
##      Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
## 1949 112 118 132 129 121 135 148 148 136 119 104 118
## 1950 115 126 141 135 125 149 170 170 158 133 114 140
## 1951 145 150 178 163 172 178 199 199 184 162 146 166
## 1952 171 180 193 181 183 218 230 242 209 191 172 194
## 1953 196 196 236 235 229 243 264 272 237 211 180 201
## 1954 204 188 235 227 234 264 302 293 259 229 203 229
## 1955 242 233 267 269 270 315 364 347 312 274 237 278
## 1956 284 277 317 313 318 374 413 405 355 306 271 306
## 1957 315 301 356 348 355 422 465 467 404 347 305 336
## 1958 340 318 362 348 363 435 491 505 404 359 310 337
## 1959 360 342 406 396 420 472 548 559 463 407 362 405
## 1960 417 391 419 461 472 535 622 606 508 461 390 432

Import xts library

  1. How many people travelled on international flights for the month of April 1951 and April 1955?
##          [,1]
## Apr 1951  163
##          [,1]
## Apr 1955  269
  1. Which year in question (i) had the most air travels and what is the difference in the numbers?
## [1] "year with most air travels"
##          [,1]
## Apr 1955  269
## [1] "difference in numbers"
##      [,1]
## [1,]  106
  1. Create a vector to store all passenger data for the year 1959.
##          [,1]
## Jan 1959  360
## Feb 1959  342
## Mar 1959  406
## Apr 1959  396
## May 1959  420
## Jun 1959  472
## Jul 1959  548
## Aug 1959  559
## Sep 1959  463
## Oct 1959  407
## Nov 1959  362
## Dec 1959  405
  1. Identify the month with the least number of air travels during this year
##          [,1]
## Feb 1959  342
  1. Identify the month with the most number of air travels
##          [,1]
## Aug 1959  559
  1. How many people altogether, travelled by air in 1959?
## [1] 5140

##Part B: Financials

Calculate the following metrics: i. Profit

##  [1]  2522.67  1911.39 -3707.79 -2914.31  -599.92  7265.24  8210.55  3944.97
##  [9]  3328.39 -2238.65   659.60 11629.54
##    Month   Profit
## 1    Jan  2522.67
## 2    Feb  1911.39
## 3    Mar -3707.79
## 4    Apr -2914.31
## 5    May  -599.92
## 6    Jun  7265.24
## 7    Jul  8210.55
## 8    Aug  3944.97
## 9    Sep  3328.39
## 10   Oct -2238.65
## 11   Nov   659.60
## 12   Dec 11629.54
## [1] "Total Profit in 2020"
## [1] 30011.68
  1. Profit after tax (the rate is set to 24%)
##  [1]  1917.23  1452.66 -2817.92 -2214.88  -455.94  5521.58  6240.02  2998.18
##  [9]  2529.58 -1701.37   501.30  8838.45
##    Month ProfitAfterTax
## 1    Jan      1917.2292
## 2    Feb      1452.6564
## 3    Mar     -2817.9204
## 4    Apr     -2214.8756
## 5    May      -455.9392
## 6    Jun      5521.5824
## 7    Jul      6240.0180
## 8    Aug      2998.1772
## 9    Sep      2529.5764
## 10   Oct     -1701.3740
## 11   Nov       501.2960
## 12   Dec      8838.4504
## [1] "Total Profit After Tax in 2020"
## [1] 22808.88
  1. The month where the company made the least profit
## [1] "Mar"