In order to use the glassdoor package, you need an API key from Glassdoor
After that is done, you need to set up the API keys. The keys are grabbed using
Sys.getenv("GLASSDOOR_PID") Sys.getenv("GLASSDOOR_PAT")
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 or gd_company.
Most of the defaults in gd_api do not need to be set, but the User-Agent defaults to
agent = gd_user_agent()
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.
if (have_gd_tokens()) { res = gd_job_stats( job_title = "sales associate", returnJobTitles = TRUE) head(res$content$response$jobTitles, 3) }
You can also access information from employers from gd_company or the
duplicate function gd_employer:
if (have_gd_tokens()) { res = gd_company( q = "dropbox") print(res$content$response$employers[[1]]$ceo) }
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.