Using API key with Gender package in R

Solution for Using API key with Gender package in R
is Given Below:

I’m using the Gender package in RStudio to determine gender from a dataset of names by connecting to the Genderize API. The number of requests I have to make exceeds the daily allowance so I’ve just bought a subscription.

However, unlike other packages that connect to Genderize (e.g. genderizer, gendered), I can’t work out how to include the API key in the code (adding the API key and alternative wordings are not recognised, e.g. gender(jop_authors_df$names, method = “genderize”, apikey = “myapikey”).

One easy fix is just to spread this out over days to not exceed the daily limit but I would ideally like to complete this more quickly (given I just bought a subscription).

My questions:

  1. Does anyone know how to connect an API key to the Gender package?
  2. Is there a way to use the httr package via GET or setting sysenv to connect to the Genderize API with the key?

The issue that I’m stuck on for question 2 is that the API for Genderize suggests requests using API key be phrased as “{YOUR_API_KEY}” (i.e. the request is in the middle of the URL and API key).

Thanks for your help. I’m an R novice so apologies for my silly questions/phrasing.