An R Steam API Client for Valve's Dota2

An R API Client for Valve's Dota2. RDota2 can be easily used to connect to the Steam API and retrieve data for Valve's popular video game Dota2. You can find out more about Dota2 at <>.

This is an R Steam API client specifically designed for Valve's game Dota2.

To install the development version you need to have the devtools package installed. To install devtools type in your console: install.packages('devtools').

Then to install RDota2 run the following on your console:


The package is planned to be released on CRAN in the future.

The typical workflow of RDota2 would include registering a key on R and then using the get_* family functions to access the API.

To register a key on R in order to use Steam API through RDota2 you firstly need to get a key from Steam. You will need a steam account in order to request a key. To get a key please visit Steam Community.

The typical way of working with RDota2 is to register a key on R (once in every section) and then that key will automatically be used within each one of the get_* family functions.

In order to register a key on R you need to use the key_actions function in the following way:

#load installed package 
#register key on R. xxxxxx is the key you received from Steam.
key_actions(action = 'register_key', value = 'xxxxxxxx')

Instead of specifying the key on your console / script (where it would be visible to anyone), good practice dictates to save it in an environment variable. This is a very easy to do process and you only need to do it once. The key will always be made easily available in your R sessions after this. In order to store the key in an environment variable you would need to do the following (the following procedure has been taken from the Appendix of Best practices for writing an API package):

  1. Identify your home directory. If you don't know which one it is just run normalizePath("~/") in the R console.
  2. In your home directory create a file called .Renviron (it shouldn't have an extension, like for example .txt). If questioned, YES you do want to use a file name that begins with a dot. Note that by default dotfiles are usually hidden. But within RStudio, the file browser will make .Renviron visible and therefore easy to edit in the future.
  3. In the .Renviron file type a line like RDota_KEY=xxxxxxxx, where RDota_KEY will be the name of the R environment variable and xxxxxxxx will be your individual Steam API Key. Make sure the last line in the file is empty (if it isn’t R will silently fail to load the file). If you’re using an editor that shows line numbers, there should be two lines, where the second one is empty.
  4. Restart your R session if you were using one, since .Renviron is parsed at the start of an R session.
  5. Access the key on your R session using Sys.getenv.

So, the best practice would be to register your key in the following way:

#load installed package 
#register key on R. Sys.getenv('RDota_KEY') will retrieve the value of the  
#RDota_KEY environment variable which is saved in your .Renviron file.
key_actions(action = 'register_key', value = Sys.getenv('RDota_KEY'))
#now you can use any of the get_*family functions without specifying a key e.g.

Each of the get_* family functions has a key argument which should only be used if you work with multiple keys.

To find out about the Steam API Documentation you can visit Steam


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.6 by Theo Boutaris, 4 months ago

Report a bug at

Browse source code at

Authors: Theo Boutaris [aut, cre, cph]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports httr, jsonlite

Suggests testthat, knitr, rmarkdown

See at CRAN