In order to use the glassdoor
package, you need an API
key from Glassdoor (either https://www.glassdoor.com/developer/register_input.htm
or click Get API key from https://www.glassdoor.com/developer/index.htm).
After that is done, you need to set up the API keys. The keys are grabbed using
so you can set these either using ~/.Renviron
(will work
generally) or your standard .profile
or
.bash_profile
(if you work with command lines).
I recommend .Renviron
as that works well with
RStudio.
The function have_gd_tokens
is a little wrapper that
allows you to check if you have both API keys set.
For example, the below code will look for employers
and
search for pharmaceuticals
within them.
library(glassdoor)
if (have_gd_tokens()) {
res = gd_api(
action = "employers",
other = NULL,
version = 1,
format = "json",
q = "pharmaceuticals")
}
The function used here is gd_api
which is the workhorse
function of the package. Generally, however, you probably want to use
gd_job_stats
, gd_job_prog
, or
gd_company
.
Most of the defaults in gd_api
do not need to be set,
but the User-Agent defaults to
If you would like to change this, simply specify the
agent
argument in the glassdoor
functions.
The job statistics specification can be found https://www.glassdoor.com/developer/jobsApiActions.htm#JobsStats.
The job statistics specification can be found https://www.glassdoor.com/developer/jobsApiActions.htm#JobProgression.
job_name = "sales associate"
if (have_gd_tokens()) {
res = gd_job_prog(
jobTitle = job_name)
head(res$content$response$results, 2)
}
which gives the percentage of transitions to another profession after being a sales associate