Write R code to generate the expected output shown below each question.
“The big mac index was invented by The Economist in 1986 as a lighthearted guide to whether currencies are at their “correct” level. It is based on the theory of purchasing-power parity (PPP), the notion that in the long run exchange rates should move towards the rate that would equalise the prices of an identical basket of goods and services (in this case, a burger) in any two countries.” (Source: https://www.economist.com/news/2020/07/15/the-big-mac-index)
## year iso_a3 currency_code name local_price dollar_ex
## 1: 2000 ARG ARS Argentina 2.50 1.000000
## 2: 2000 AUS AUD Australia 2.59 1.680000
## 3: 2000 BRA BRL Brazil 2.95 1.790000
## 4: 2000 CAN CAD Canada 2.85 1.470000
## 5: 2000 CHE CHF Switzerland 5.90 1.700000
## 6: 2000 CHL CLP Chile 1260.00 514.000000
## 7: 2000 CHN CNY China 9.90 8.280000
## 8: 2000 CZE CZK Czech Republic 54.37 39.100000
## 9: 2000 DNK DKK Denmark 24.75 8.040000
## 10: 2000 EUZ EUR Euro area 2.56 1.075269
## dollar_price gdp_dollar
## 1: 2.500000 NA
## 2: 1.541667 NA
## 3: 1.648045 NA
## 4: 1.938776 NA
## 5: 3.470588 NA
## 6: 2.451362 NA
## 7: 1.195652 NA
## 8: 1.390537 NA
## 9: 3.078358 NA
## 10: 2.380800 NA
Data Dictionary:
year: Year of observation
iso_a3:
Three-character ISO 3166-1 country code
name: County name
local_price: Price of a Big Mac in the local currency
dollar_ex:
Local currency units per dollar (Exchange rate)
dollar_price: Price
of a Big Mac in dollars
gdp_dollar: GDP per person, in
dollars
## year mean_price min_price max_price
## 1: 2000 2.069903 1.1894737 3.580247
## 2: 2001 1.891209 1.1729622 3.641618
## 3: 2002 2.020765 0.7987220 4.088785
## 4: 2003 2.147612 1.1956522 4.598540
## 5: 2004 2.259276 0.6399659 5.183163
## 6: 2005 2.508365 1.2686675 6.062867
## year local_price
## 1: 2000 2.51
## 2: 2001 2.54
## 3: 2002 2.49
## 4: 2003 2.71
## 5: 2004 2.90
## 6: 2005 3.06
## year US_price
## 1: 2000 2.51
## 2: 2001 2.54
## 3: 2002 2.49
## 4: 2003 2.71
## 5: 2004 2.90
## 6: 2005 3.06
## year iso_a3 currency_code name local_price dollar_ex dollar_price
## 1: 2000 ARG ARS Argentina 2.50 1.00 2.500000
## 2: 2000 AUS AUD Australia 2.59 1.68 1.541667
## 3: 2000 BRA BRL Brazil 2.95 1.79 1.648045
## 4: 2000 CAN CAD Canada 2.85 1.47 1.938776
## 5: 2000 CHE CHF Switzerland 5.90 1.70 3.470588
## 6: 2000 CHL CLP Chile 1260.00 514.00 2.451362
## gdp_dollar US_price
## 1: NA 2.51
## 2: NA 2.51
## 3: NA 2.51
## 4: NA 2.51
## 5: NA 2.51
## 6: NA 2.51
## year iso_a3 currency_code name local_price dollar_ex dollar_price
## 1: 2000 ARG ARS Argentina 2.50 1.00 2.500000
## 2: 2000 AUS AUD Australia 2.59 1.68 1.541667
## 3: 2000 BRA BRL Brazil 2.95 1.79 1.648045
## 4: 2000 CAN CAD Canada 2.85 1.47 1.938776
## 5: 2000 CHE CHF Switzerland 5.90 1.70 3.470588
## 6: 2000 CHL CLP Chile 1260.00 514.00 2.451362
## gdp_dollar US_price bigmac_ex diff
## 1: NA 2.51 0.9960159 -0.003984064
## 2: NA 2.51 1.0318725 -0.385790173
## 3: NA 2.51 1.1752988 -0.343408489
## 4: NA 2.51 1.1354582 -0.227579478
## 5: NA 2.51 2.3505976 0.382704476
## 6: NA 2.51 501.9920319 -0.023361806
## year iso_a3 currency_code name local_price dollar_ex dollar_price
## 1: 2000 ARG ARS Argentina 2.50 1.00 2.500000
## 2: 2000 AUS AUD Australia 2.59 1.68 1.541667
## 3: 2000 BRA BRL Brazil 2.95 1.79 1.648045
## 4: 2000 CAN CAD Canada 2.85 1.47 1.938776
## 5: 2000 CHE CHF Switzerland 5.90 1.70 3.470588
## 6: 2000 CHL CLP Chile 1260.00 514.00 2.451362
## gdp_dollar US_price bigmac_ex diff undervalued
## 1: NA 2.51 0.9960159 -0.003984064 1
## 2: NA 2.51 1.0318725 -0.385790173 1
## 3: NA 2.51 1.1752988 -0.343408489 1
## 4: NA 2.51 1.1354582 -0.227579478 1
## 5: NA 2.51 2.3505976 0.382704476 0
## 6: NA 2.51 501.9920319 -0.023361806 1
## undervalued N
## 1: 1 53
## 2: 0 3
## [1] "Switzerland" "Norway"