Need human census data for any of your analyses? Follow these simple steps

25 02 2022

As someone who regularly delves into human demography — often from a conservation perspective — I’m always on the lookout for quick and easy ways to get the latest and greatest datasets. Whether it’s for projection human populations, or just getting country-specific population densities, I’ve found a really nice way to interface great human data with R.

In this particular example, I’m using a api (application programming interface) key to access live data on the US Census Bureau server (don’t worry — they have global data, not just those specific to the US). What’s an ‘api key’? It’s just a code that gives you permission to access the server directly from an application via an internet link.

Step 1. Apply for an api key

This is a straightforward process and just needs to be done via this URL. The approval process doesn’t take long.

Step 2: Install the idbr package in R

This stands for the ‘(US Census Bureau) International Data Base (R)’, and grants access to and queries demographic data, including contemporary, historical, and future projections to 2100 for countries with ≥ 5000 people.

install.packages(“idbr”)

Step 3: Set api key

You need to set your user api using the following commands:

apikey <- “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
idbr::idb_api_key(apikey)

Step 4. Get data

Using the get_idb() command, you can specify all sorts of queries to get various levels of data complexity. All the variable combinations for the international database are described well here.

Example 1. Life expectancy

Let’s say you wanted to plot a map of the world with the shading of a country related to its average life expectancy at birth. First we get the necessary data:

lex.dat <- idbr::get_idb(
country = “all”,
year = 2022,
variables = c(“name”, “e0”),
geometry = T)

The ensuing lex.dat object looks like this:

Simple feature collection with 6 features and 4 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -73.41544 ymin: -55.25 xmax: 75.15803 ymax: 42.68825
Geodetic CRS: SOURCECRS
code year name e0 geometry
1 AF 2022 Afghanistan 53.65 MULTIPOLYGON (((61.21082 35…
2 AO 2022 Angola 62.11 MULTIPOLYGON (((16.32653 -5…
3 AL 2022 Albania 79.47 MULTIPOLYGON (((20.59025 41…
4 AE 2022 United Arab Emirates 79.56 MULTIPOLYGON (((51.57952 24…
5 AR 2022 Argentina 78.31 MULTIPOLYGON (((-65.5 -55.2…
6 AM 2022 Armenia 76.13 MULTIPOLYGON (((43.58275 41

Read the rest of this entry »




Cartoon guide to biodiversity loss LXX

16 02 2022

Here is the first set of biodiversity cartoons for 2022. See full stock of previous ‘Cartoon guide to biodiversity loss’ compendia here.


Read the rest of this entry »




Wondering if you should apply for a DECRA?

7 02 2022

Do you love doing job applications, but wish they were longer and more involved?

If so, applying for an Australian Research Council (ARC) Discovery Early Career Researcher Award (DECRA) should be right up your alley.

If, like most people, you answered a resounding NO! to that question, there are still many good reasons to apply for a DECRA. But there are also some completely valid reasons why you might not apply, so it pays to weigh up the pros and cons if you’re thinking about it.

Let’s go through some of these points, plus tips on how to make a competitive application (I just submitted a DECRA application in the last round, so it’s all painfully fresh in my memory). 

What the hell is a DECRA?

The Discovery Early Career Researcher Awards offered by the Australian Research Council are highly competitive, with success rates of between 12% (ouch!) and 20% across years (but expect especially low success rates in the next round/DECRA23, given the bumper crop of applicants). 

DECRAs are restricted to researchers who are (i) less than 5-years out from their PhD conferral, and (ii) who are proposing non-medical projects.

The 5-year eligibility period is based on time spent ‘research active’, to accommodate the different career pathways people follow. This means that people who haven’t been working 100% in research since completing their PhD can tally up career interruptions (which can relate to illnesses or disability, carer responsibilities, parental leave, unemployment, and employment in non-research positions) and extend their eligibility period.

So even if you are well-over 5 years post PhD (as was the case for me), you might still be eligible to apply. If you’re considering a medical science project, then you need to check out the schemes offered by the National Health and Medical Research Council (NHMRC).

Pros and Cons

Read the rest of this entry »







%d bloggers like this: