Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7810561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:49:41+00:00 2026-06-02T03:49:41+00:00

I am using the R package WDI which allows importing of World Bank data

  • 0

I am using the R package WDI which allows importing of World Bank data through their API. The problem is that I want to look at all countries in a region, e.g. Sub-Saharan Africa. However for this I need to specify so many countries (SSH is 49 right now).

To start with this is inefficient, especially considering that the data explorer on data.worldbank.org does allow you to select a region.

However the real problem is that the number of countries becomes problematic to handle for (I’ m guessing) the World Bank API, because a too-large number of countries gives an HTTP error. Causing me to have to split the request in two parts.

However, when using the more efficient ALL value there is no error, even though the number of observations is a lot higher.

Right now my code looks like this:

library(WDI)

COUNTRIES1 <- c( "AGO","BEN","BWA","BFA","BDI","CMR","CPV","CAF","TCD","COM","ZAR","COG","CIV","GNQ","ERI","ETH","GAB","GMB","GHA","GNB","GIN","KEN","LSO","LBR","MDG" )
COUNTRIES2 <- c( "MWI","MLI","MRT","MUS","MYT","MOZ","NAM","NER","NGA","RWA","STP","SEN","SYC","SLE","SOM","ZAF","SSD","SDN","SWZ","TZA","TGO","UGA","ZMB","ZWE" )
INDICATORS <- c("NY.GDP.PCAP.KN", "SP.DYN.TFRT.IN", "SP.POP.TOTL")

LONG1 <- WDI( country=COUNTRIES1, indicator=INDICATORS, start=1960, end=2009, extra=FALSE)
LONG2 <- WDI( country=COUNTRIES2, indicator=INDICATORS, start=1960, end=2009, extra=FALSE)

LONG <- merge( LONG1, LONG2, by=intersect( names(LONG1),names(LONG2) ), all=TRUE )

I have tried using SSH as a country code, but this gives an aggregate of all SSH countries, rather than all the observations.

Any idea’s?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:49:42+00:00Added an answer on June 2, 2026 at 3:49 am

    You can download the data for all countries
    and use the Region to filter the results.

    library(WDI)
    indicators <- c("NY.GDP.PCAP.KN", "SP.DYN.TFRT.IN", "SP.POP.TOTL")
    d <- WDI("all", indicators, extra=TRUE, start=1960, end=2009)
    # Discard unwanted rows
    d <- d[ which(d$Region == "Sub-Saharan Africa"), ]
    # Discard unwanted columns
    d <- d[,1:6]
    head(d)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've installed the CL-PNG package using quicklisp. (ql:quicklisp 'png) Now I want to define
I have created a package using PackageMaker and want to change the default icon
I'm usually using reshape package to aggregate some data (d'uh), usually with plyr ,
I have an app that I want to incorporate Sensor data into. My first
I am using package qvalue which has the following pre-processing step if(min(p)<0 || max(p)>1)
I am using a package in Perl (Biomart) that prints out the results of
I am trying to create an installer using Package Maker, which installs a plugin
I have created an installation package using Wix which installs a Windows service on
Hi I am using package-maker of Mac OS to create installer package for Mac
I am using caret package for R to select variables for my model. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.