# NOT RUN {
# gdp for all countries for all available dates
# }
# NOT RUN {
df_gdp <- wb_data("NY.GDP.MKTP.CD")
# }
# NOT RUN {
# Brazilian gdp for all available dates
# }
# NOT RUN {
df_brazil <- wb_data("NY.GDP.MKTP.CD", country = "br")
# }
# NOT RUN {
# Brazilian gdp for 2006
# }
# NOT RUN {
df_brazil_1 <- wb_data("NY.GDP.MKTP.CD", country = "brazil", start_date = 2006)
# }
# NOT RUN {
# Brazilian gdp for 2006-2010
# }
# NOT RUN {
df_brazil_2 <- wb_data("NY.GDP.MKTP.CD", country = "BRA",
start_date = 2006, end_date = 2010)
# }
# NOT RUN {
# Population, GDP, Unemployment Rate, Birth Rate (per 1000 people)
# }
# NOT RUN {
my_indicators <- c("SP.POP.TOTL",
"NY.GDP.MKTP.CD",
"SL.UEM.TOTL.ZS",
"SP.DYN.CBRT.IN")
# }
# NOT RUN {
# }
# NOT RUN {
df <- wb_data(my_indicators)
# }
# NOT RUN {
# you pass multiple country ids of different types
# Albania (iso2c), Georgia (iso3c), and Mongolia
# }
# NOT RUN {
my_countries <- c("AL", "Geo", "mongolia")
df <- wb_data(my_indicators, country = my_countries,
start_date = 2005, end_date = 2007)
# }
# NOT RUN {
# same data as above, but in long format
# }
# NOT RUN {
df_long <- wb_data(my_indicators, country = my_countries,
start_date = 2005, end_date = 2007,
return_wide = FALSE)
# }
# NOT RUN {
# regional population totals
# regions correspond to the region column in wb_cachelist$countries
# }
# NOT RUN {
df_region <- wb_data("SP.POP.TOTL", country = "regions_only",
start_date = 2010, end_date = 2014)
# }
# NOT RUN {
# a specific region
# }
# NOT RUN {
df_world <- wb_data("SP.POP.TOTL", country = "world",
start_date = 2010, end_date = 2014)
# }
# NOT RUN {
# if the indicator is part of a named vector the name will be the column name
my_indicators <- c("pop" = "SP.POP.TOTL",
"gdp" = "NY.GDP.MKTP.CD",
"unemployment_rate" = "SL.UEM.TOTL.ZS",
"birth_rate" = "SP.DYN.CBRT.IN")
# }
# NOT RUN {
df_names <- wb_data(my_indicators, country = "world",
start_date = 2010, end_date = 2014)
# }
# NOT RUN {
# custom names are ignored if returning in long format
# }
# NOT RUN {
df_names_long <- wb_data(my_indicators, country = "world",
start_date = 2010, end_date = 2014,
return_wide = FALSE)
# }
# NOT RUN {
# same as above but in Bulgarian
# note that not all indicators have translations for all languages
# }
# NOT RUN {
df_names_long_bg <- wb_data(my_indicators, country = "world",
start_date = 2010, end_date = 2014,
return_wide = FALSE, lang = "bg")
# }
Run the code above in your browser using DataLab