library(readr)
gdp <- read_csv("gdp.csv")
## Parsed with column specification:
## cols(
## .default = col_double(),
## `Country Name` = col_character(),
## `Country Code` = col_character()
## )
## See spec(...) for full column specifications.
dim(gdp) # see the number of rows and columns
## [1] 264 60
## Part b: Compute the difference in GDP 2017-2007
gdp["diff"] <- NA #create the column to store the diff
dim(gdp)
## [1] 264 61
gdp$diff <- gdp$"2017"-gdp$"2007"
options(scipen=999) # turn off sn.
countries <- gdp$"Country Name"[gdp$diff > 1000000000000]
print(countries)
## [1] NA
## [2] NA
## [3] NA
## [4] NA
## [5] "China"
## [6] NA
## [7] NA
## [8] NA
## [9] "East Asia & Pacific (excluding high income)"
## [10] "Early-demographic dividend"
## [11] "East Asia & Pacific"
## [12] NA
## [13] NA
## [14] NA
## [15] NA
## [16] NA
## [17] "High income"
## [18] "IBRD only"
## [19] "IDA & IBRD total"
## [20] "IDA total"
## [21] NA
## [22] "India"
## [23] NA
## [24] "Latin America & Caribbean (excluding high income)"
## [25] "Latin America & Caribbean"
## [26] NA
## [27] "Lower middle income"
## [28] "Low & middle income"
## [29] "Late-demographic dividend"
## [30] NA
## [31] NA
## [32] "Middle East & North Africa"
## [33] "Middle income"
## [34] NA
## [35] "North America"
## [36] NA
## [37] "OECD members"
## [38] NA
## [39] NA
## [40] "Post-demographic dividend"
## [41] NA
## [42] "South Asia"
## [43] NA
## [44] NA
## [45] NA
## [46] NA
## [47] NA
## [48] "East Asia & Pacific (IDA & IBRD countries)"
## [49] "Latin America & the Caribbean (IDA & IBRD countries)"
## [50] "South Asia (IDA & IBRD)"
## [51] "Upper middle income"
## [52] "United States"
## [53] NA
## [54] NA
## [55] NA
## [56] "World"
## [57] NA