RDota2

Theo Boutaris

2016-10-30

RDota2 is an R Steam API client for Valve’s game Dota2.

In order to use the package you will need to have a Steam Key which you can get from Steam Community. You will also need a Steam account in order to request a key.

Usage

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

Registering a key on R

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 
library(RDota2)
#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 take the next steps (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:

#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'))
## Key set successfully
#now you can use any of the get_* family functions without specifying a key e.g.
heroes <- get_heroes()
head(heroes$content)
##                           name id localized_name
## 1       npc_dota_hero_antimage  1      Anti-Mage
## 2            npc_dota_hero_axe  2            Axe
## 3           npc_dota_hero_bane  3           Bane
## 4    npc_dota_hero_bloodseeker  4    Bloodseeker
## 5 npc_dota_hero_crystal_maiden  5 Crystal Maiden
## 6    npc_dota_hero_drow_ranger  6    Drow Ranger

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

Other Key Actions

Other key actions include retrieving a key (to make sure it has been set for example) or deleting the key:

#retrieve key
key_actions('get_key')
#delete key
key_actions('delete_key')

get_* Family Funtions

The get_* family functions are the functions used to access the API. They map the following API methods:

Dota 2 methods relating to match information:

Dota 2 methods relating to Dota 2 economy:

You can access the Steam API Documentation from this link.

All get_* functions have three common arguments that can be used:

Moreover, all get_* functions will return a dota_api object that contains 3 elements:

By default when printing a dota_api object only the content element will be printed on screen.

The above are true for all the get_* functions, so they will not be analysed in detail in the individual function demonstration that follows.

get_league_listing

get_league_listing returns information about Dota TV-supported leagues. The function does not require any extra arguments and outputs a data.frame with the following columns:

Steam API Documentation: GetLeagueListing

str(get_league_listing()$content)
## 'data.frame':    1553 obs. of  5 variables:
##  $ name          : chr  "Dota 2 Just For Fun" "joinDOTA League Season 3" "Killing Spree: North America" "Wild Cards West" ...
##  $ leagueid      : int  1212 1640 25 2 3 4 5 6 7 8 ...
##  $ description   : chr  "64 of the best Brazilian amateur teams compete to become the winner of the first Dota 2 Just For Fun tournament. " "The global Dota 2 league for everyone. Featured are all of the matches from division 1 and 2. There are three leagues: Europe, "| __truncated__ "Killing Spree is a perpetual King of the Hill event featuring four premier teams from North America. Each team will battle thei"| __truncated__ "Watch eight of the best Dota 2 teams compete for a spot in The International" ...
##  $ tournament_url: chr  "https://binarybeast.com/xDOTA21404228/" "http://www.joindota.com/en/leagues/" "http://neodota.com/?page_id=1389" "http://www.dota2.com/tournaments/international/" ...
##  $ itemdef       : int  10541 10742 15014 15015 15016 15018 15042 15047 15049 15051 ...

get_live_league_games

get_live_league_games returns information about the live league games. The function does not require any extra arguments and outputs a list (called games), of which each element is a game. Each game contains the following information (some might be missing for some games):

Steam API Documentation: GetLiveLeagueGames

#information returned about the first game
str(get_live_league_games()$content$games[[1]])
#### List of 17
##  $ players            :List of 11
##   ..$ :List of 4
##   .. ..$ account_id: int 292934088
##   .. ..$ name      : chr "FACEIT.com | Shannon Bot"
##   .. ..$ hero_id   : int 0
##   .. ..$ team      : int 4
##   ..$ :List of 4
##   .. ..$ account_id: int 124344565
##   .. ..$ name      : chr "Ryadovoi Lebys"
##   .. ..$ hero_id   : int 91
##   .. ..$ team      : int 1
##   ..$ :List of 4
##   .. ..$ account_id: int 374473137
##   .. ..$ name      : chr "<U+041D><U+0410><U+0421><U+0415><U+041A><U+041E><U+041C><U+042B><U+0428>""| __truncated__
##   .. ..$ hero_id   : int 90
##   .. ..$ team      : int 1
##   ..$ :List of 4
##   .. ..$ account_id: int 53178236
##   .. ..$ name      : chr "Sedoy"
##   .. ..$ hero_id   : int 18
##   .. ..$ team      : int 0
##   ..$ :List of 4
##   .. ..$ account_id: int 84692724
##   .. ..$ name      : chr "PANDA"
##   .. ..$ hero_id   : int 110
##   .. ..$ team      : int 1
##   ..$ :List of 4
##   .. ..$ account_id: int 86840554
##   .. ..$ name      : chr "tmw"
##   .. ..$ hero_id   : int 15
##   .. ..$ team      : int 0
##   ..$ :List of 4
##   .. ..$ account_id: int 123787524
##   .. ..$ name      : chr "Shachlo"
##   .. ..$ hero_id   : int 60
##   .. ..$ team      : int 0
##   ..$ :List of 4
##   .. ..$ account_id: int 159020918
##   .. ..$ name      : chr "RodjER"
##   .. ..$ hero_id   : int 37
##   .. ..$ team      : int 0
##   ..$ :List of 4
##   .. ..$ account_id: int 148096933
##   .. ..$ name      : chr "number0"
##   .. ..$ hero_id   : int 47
##   .. ..$ team      : int 1
##   ..$ :List of 4
##   .. ..$ account_id: int 11550182
##   .. ..$ name      : chr "VANSKOR"
##   .. ..$ hero_id   : int 69
##   .. ..$ team      : int 0
##   ..$ :List of 4
##   .. ..$ account_id: int 86817707
##   .. ..$ name      : chr "72293768"
##   .. ..$ hero_id   : int 82
##   .. ..$ team      : int 1
##  $ radiant_team       :List of 4
##   ..$ team_name: chr "FlipSid3 Tactics"
##   ..$ team_id  : int 2790766
##   ..$ team_logo: num 2.78e+17
##   ..$ complete : logi TRUE
##  $ lobby_id           : num 2.48e+16
##  $ match_id           : num 2.73e+09
##  $ spectators         : int 1256
##  $ series_id          : int 0
##  $ game_number        : int 0
##  $ league_id          : int 5027
##  $ stream_delay_s     : int 300
##  $ radiant_series_wins: int 0
##  $ dire_series_wins   : int 0
##  $ series_type        : int 0
##  $ league_series_id   : int 0
##  $ league_game_id     : int 0
##  $ stage_name         : chr ""
##  $ league_tier        : int 3
##  $ scoreboard         :List of 4
##   ..$ duration            : num 1035
##   ..$ roshan_respawn_timer: int 377
##   ..$ radiant             :List of 11
##   .. ..$ score         : int 13
##   .. ..$ tower_state   : int 1983
##   .. ..$ barracks_state: int 63
##   .. ..$ picks         :List of 5
## truncated...

get_match_details

get_match_details provides information about the game and the players participating in a specific match. The function requires a match_id to be provided. The function ouputs a list which contains information about the players and the match. The first element of the content list contains information about the players. The following details are included:

The rest of the elements of the content list contain information about the match. The following details are included:

Steam API Documentation: GetMatchDetails

#match list contains information about both players and the match
match_details <- get_match_details(match_id = 2686721815)$content

#match_details[[1]] is a list with all the players - usually 10
#match_details[[1]][[1]] is just one of the 10 players
str(match_details[[1]][[1]])
## List of 27
##  $ account_id         : num 4.29e+09
##  $ player_slot        : int 0
##  $ hero_id            : int 106
##  $ item_0             : int 54
##  $ item_1             : int 0
##  $ item_2             : int 145
##  $ item_3             : int 48
##  $ item_4             : int 185
##  $ item_5             : int 11
##  $ kills              : int 2
##  $ deaths             : int 1
##  $ assists            : int 16
##  $ leaver_status      : int 0
##  $ last_hits          : int 92
##  $ denies             : int 3
##  $ gold_per_min       : int 411
##  $ xp_per_min         : int 461
##  $ level              : int 17
##  $ hero_damage        : int 8107
##  $ tower_damage       : int 1425
##  $ hero_healing       : int 0
##  $ gold               : int 948
##  $ gold_spent         : int 13620
##  $ scaled_hero_damage : int 7420
##  $ scaled_tower_damage: int 1058
##  $ scaled_hero_healing: int 0
##  $ ability_upgrades   :List of 17
##   ..$ :List of 3
##   .. ..$ ability: int 5603
##   .. ..$ time   : int 141
##   .. ..$ level  : int 1
##   ..$ :List of 3
##   .. ..$ ability: int 5605
##   .. ..$ time   : int 295
##   .. ..$ level  : int 2
##   ..$ :List of 3
##   .. ..$ ability: int 5604
##   .. ..$ time   : int 324
##   .. ..$ level  : int 3
##   ..$ :List of 3
##   .. ..$ ability: int 5603
##   .. ..$ time   : int 385
##   .. ..$ level  : int 4
##   ..$ :List of 3
##   .. ..$ ability: int 5603
##   .. ..$ time   : int 489
##   .. ..$ level  : int 5
##   ..$ :List of 3
##   .. ..$ ability: int 5606
##   .. ..$ time   : int 560
##   .. ..$ level  : int 6
##   ..$ :List of 3
##   .. ..$ ability: int 5603
##   .. ..$ time   : int 646
##   .. ..$ level  : int 7
##   ..$ :List of 3
##   .. ..$ ability: int 5605
##   .. ..$ time   : int 850
##   .. ..$ level  : int 8
##   ..$ :List of 3
##   .. ..$ ability: int 5605
##   .. ..$ time   : int 1012
##   .. ..$ level  : int 9
##   ..$ :List of 3
##   .. ..$ ability: int 5605
##   .. ..$ time   : int 1264
##   .. ..$ level  : int 10
##   ..$ :List of 3
##   .. ..$ ability: int 5606
##   .. ..$ time   : int 1298
##   .. ..$ level  : int 11
##   ..$ :List of 3
##   .. ..$ ability: int 5604
##   .. ..$ time   : int 1635
##   .. ..$ level  : int 12
##   ..$ :List of 3
##   .. ..$ ability: int 5604
##   .. ..$ time   : int 1772
##   .. ..$ level  : int 13
##   ..$ :List of 3
##   .. ..$ ability: int 5604
##   .. ..$ time   : int 1909
##   .. ..$ level  : int 14
##   ..$ :List of 3
##   .. ..$ ability: int 5002
##   .. ..$ time   : int 2063
##   .. ..$ level  : int 15
##   ..$ :List of 3
##   .. ..$ ability: int 5606
##   .. ..$ time   : int 2149
##   .. ..$ level  : int 16
##   ..$ :List of 3
##   .. ..$ ability: int 5002
##   .. ..$ time   : int 2200
##   .. ..$ level  : int 17
#information about the match
str(match_details[-1])
## List of 22
##  $ radiant_win            : logi TRUE
##  $ duration               : int 2016
##  $ pre_game_duration      : int 75
##  $ start_time             : int 1475527616
##  $ match_id               : num 2.69e+09
##  $ match_seq_num          : num 2.35e+09
##  $ tower_status_radiant   : int 1844
##  $ tower_status_dire      : int 4
##  $ barracks_status_radiant: int 63
##  $ barracks_status_dire   : int 3
##  $ cluster                : int 137
##  $ first_blood_time       : int 517
##  $ lobby_type             : int 0
##  $ human_players          : int 10
##  $ leagueid               : int 0
##  $ positive_votes         : int 0
##  $ negative_votes         : int 0
##  $ game_mode              : int 1
##  $ flags                  : int 0
##  $ engine                 : int 1
##  $ radiant_score          : int 35
##  $ dire_score             : int 10

get_match_history

get_match_details provides information about matches according to a number of parameters. The available parameters are:

The content element of the list contains a list called matches. Each element of matches list is a match. Each match contains the following sections:

Steam API Documentation: GetMatchHistory

#match list contains information about both players and the match
match_details <- get_match_history(matches_requested = 2, 
                                   date_min = '2015-01-01 16:00:00', 
                                   hero_id = 1)$content

#information about the first match
str(match_details[[1]][[1]])
## List of 7
##  $ match_id       : num 2.74e+09
##  $ match_seq_num  : num 2.4e+09
##  $ start_time     : int 1477826881
##  $ lobby_type     : int 8
##  $ radiant_team_id: int 0
##  $ dire_team_id   : int 0
##  $ players        :List of 2
##   ..$ :List of 3
##   .. ..$ account_id : num 4.29e+09
##   .. ..$ player_slot: int 0
##   .. ..$ hero_id    : int 1
##   ..$ :List of 3
##   .. ..$ account_id : int 367708113
##   .. ..$ player_slot: int 128
##   .. ..$ hero_id    : int 11

get_match_history_by_sequence_num

get_match_history_by_sequence_num provides information about matches ordered by a sequence number. The function can get start_at_match_seq_num and matches_requested as arguments but both are optional. The function returns a list called matches. Each match follows exactly the same structure as the match retrieved from get_match_details.
Please see that function for the exact details.

Steam API Documentation: GetMatchHistoryBySequenceNum

#get 1 match (out of 2) - match_seq_nums are 250 and 251 
str(get_match_history_by_sequence_num(matches_requested = 2, 
                                      start_at_match_seq_num = 250)$content$matches[[1]])
## List of 23
##  $ players                :List of 10
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 0
##   .. ..$ hero_id            : int 7
##   .. ..$ item_0             : int 73
##   .. ..$ item_1             : int 180
##   .. ..$ item_2             : int 1
##   .. ..$ item_3             : int 73
##   .. ..$ item_4             : int 16
##   .. ..$ item_5             : int 162
##   .. ..$ kills              : int 7
##   .. ..$ deaths             : int 17
##   .. ..$ assists            : int 10
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 90
##   .. ..$ denies             : int 7
##   .. ..$ gold_per_min       : int 244
##   .. ..$ xp_per_min         : int 453
##   .. ..$ level              : int 19
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 1158
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : int 72557050
##   .. ..$ player_slot        : int 1
##   .. ..$ hero_id            : int 2
##   .. ..$ item_0             : int 63
##   .. ..$ item_1             : int 125
##   .. ..$ item_2             : int 44
##   .. ..$ item_3             : int 39
##   .. ..$ item_4             : int 26
##   .. ..$ item_5             : int 16
##   .. ..$ kills              : int 6
##   .. ..$ deaths             : int 17
##   .. ..$ assists            : int 6
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 34
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 193
##   .. ..$ xp_per_min         : int 327
##   .. ..$ level              : int 16
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 1284
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 2
##   .. ..$ hero_id            : int 8
##   .. ..$ item_0             : int 11
##   .. ..$ item_1             : int 164
##   .. ..$ item_2             : int 5
##   .. ..$ item_3             : int 63
##   .. ..$ item_4             : int 0
##   .. ..$ item_5             : int 3
##   .. ..$ kills              : int 5
##   .. ..$ deaths             : int 13
##   .. ..$ assists            : int 6
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 64
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 219
##   .. ..$ xp_per_min         : int 418
##   .. ..$ level              : int 18
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 1463
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 3
##   .. ..$ hero_id            : int 29
##   .. ..$ item_0             : int 73
##   .. ..$ item_1             : int 63
##   .. ..$ item_2             : int 0
##   .. ..$ item_3             : int 36
##   .. ..$ item_4             : int 0
##   .. ..$ item_5             : int 46
##   .. ..$ kills              : int 1
##   .. ..$ deaths             : int 18
##   .. ..$ assists            : int 10
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 35
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 154
##   .. ..$ xp_per_min         : int 229
##   .. ..$ level              : int 13
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 1579
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 4
##   .. ..$ hero_id            : int 14
##   .. ..$ item_0             : int 92
##   .. ..$ item_1             : int 131
##   .. ..$ item_2             : int 29
##   .. ..$ item_3             : int 21
##   .. ..$ item_4             : int 0
##   .. ..$ item_5             : int 0
##   .. ..$ kills              : int 5
##   .. ..$ deaths             : int 14
##   .. ..$ assists            : int 6
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 49
##   .. ..$ denies             : int 4
##   .. ..$ gold_per_min       : int 184
##   .. ..$ xp_per_min         : int 282
##   .. ..$ level              : int 15
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 1647
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 128
##   .. ..$ hero_id            : int 22
##   .. ..$ item_0             : int 36
##   .. ..$ item_1             : int 41
##   .. ..$ item_2             : int 108
##   .. ..$ item_3             : int 29
##   .. ..$ item_4             : int 46
##   .. ..$ item_5             : int 73
##   .. ..$ kills              : int 6
##   .. ..$ deaths             : int 4
##   .. ..$ assists            : int 40
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 34
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 261
##   .. ..$ xp_per_min         : int 480
##   .. ..$ level              : int 20
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 3972
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 129
##   .. ..$ hero_id            : int 19
##   .. ..$ item_0             : int 73
##   .. ..$ item_1             : int 180
##   .. ..$ item_2             : int 108
##   .. ..$ item_3             : int 114
##   .. ..$ item_4             : int 172
##   .. ..$ item_5             : int 21
##   .. ..$ kills              : int 21
##   .. ..$ deaths             : int 4
##   .. ..$ assists            : int 39
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 90
##   .. ..$ denies             : int 1
##   .. ..$ gold_per_min       : int 437
##   .. ..$ xp_per_min         : int 748
##   .. ..$ level              : int 25
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 3783
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 130
##   .. ..$ hero_id            : int 18
##   .. ..$ item_0             : int 41
##   .. ..$ item_1             : int 63
##   .. ..$ item_2             : int 73
##   .. ..$ item_3             : int 0
##   .. ..$ item_4             : int 116
##   .. ..$ item_5             : int 0
##   .. ..$ kills              : int 7
##   .. ..$ deaths             : int 8
##   .. ..$ assists            : int 29
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 53
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 264
##   .. ..$ xp_per_min         : int 385
##   .. ..$ level              : int 17
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 1450
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 131
##   .. ..$ hero_id            : int 32
##   .. ..$ item_0             : int 11
##   .. ..$ item_1             : int 63
##   .. ..$ item_2             : int 174
##   .. ..$ item_3             : int 112
##   .. ..$ item_4             : int 0
##   .. ..$ item_5             : int 0
##   .. ..$ kills              : int 13
##   .. ..$ deaths             : int 8
##   .. ..$ assists            : int 12
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 57
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 314
##   .. ..$ xp_per_min         : int 535
##   .. ..$ level              : int 21
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 2380
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##   ..$ :List of 26
##   .. ..$ account_id         : num 4.29e+09
##   .. ..$ player_slot        : int 132
##   .. ..$ hero_id            : int 47
##   .. ..$ item_0             : int 63
##   .. ..$ item_1             : int 125
##   .. ..$ item_2             : int 114
##   .. ..$ item_3             : int 108
##   .. ..$ item_4             : int 0
##   .. ..$ item_5             : int 0
##   .. ..$ kills              : int 29
##   .. ..$ deaths             : int 4
##   .. ..$ assists            : int 26
##   .. ..$ leaver_status      : int 0
##   .. ..$ last_hits          : int 63
##   .. ..$ denies             : int 0
##   .. ..$ gold_per_min       : int 415
##   .. ..$ xp_per_min         : int 657
##   .. ..$ level              : int 23
##   .. ..$ hero_damage        : int 0
##   .. ..$ tower_damage       : int 0
##   .. ..$ hero_healing       : int 0
##   .. ..$ gold               : int 3480
##   .. ..$ gold_spent         : int 0
##   .. ..$ scaled_hero_damage : int 0
##   .. ..$ scaled_tower_damage: int 0
##   .. ..$ scaled_hero_healing: int 0
##  $ radiant_win            : logi FALSE
##  $ duration               : int 2619
##  $ pre_game_duration      : int 0
##  $ start_time             : int 1299266365
##  $ match_id               : int 506
##  $ match_seq_num          : int 250
##  $ tower_status_radiant   : int 0
##  $ tower_status_dire      : int 0
##  $ barracks_status_radiant: int 0
##  $ barracks_status_dire   : int 0
##  $ cluster                : int 0
##  $ first_blood_time       : int 0
##  $ lobby_type             : int 0
##  $ human_players          : int 10
##  $ leagueid               : int 0
##  $ positive_votes         : int 0
##  $ negative_votes         : int 0
##  $ game_mode              : int 0
##  $ flags                  : int 0
##  $ engine                 : int 0
##  $ radiant_score          : int 0
##  $ dire_score             : int 0

get_scheduled_league_games

get_scheduled_league_games returns a list of scheduled league games coming up. The function can get two optional arguments date_min and date_max specifying the time period in which to get the games. The function returns a list called games. Each game contains the following sections:

Steam API DOcumentation GetScheduledLeagueGames

#no scheduled games at the time of writing
str(get_scheduled_league_games()$content)
## List of 1
##  $ result:List of 1
##   ..$ games: list()

get_team_info_by_team_id

get_team_info_by_team_id provides informationa about a team given a team id. The function can get two optional arguments. start_at_team_id specifies the team id to start returning results from and teams_requested specifies the number of teams to return. The function returns a teams list of which each element is a match. The following information for each match is provided:

Steam API Documentation: GetTeamInfoByTeamID

#information about one team
str(get_team_info_by_team_id()$content$teams[[1]])
## List of 13
##  $ name                       : chr "Zenith"
##  $ tag                        : chr "Zenith"
##  $ time_created               : int 1338330222
##  $ calibration_games_remaining: int 3
##  $ logo                       : num 7.12e+17
##  $ logo_sponsor               : num 7.12e+17
##  $ country_code               : chr "sg"
##  $ url                        : chr "www.dota2.com.cn"
##  $ games_played               : int 439
##  $ player_0_account_id        : int 84772440
##  $ player_1_account_id        : int 85417034
##  $ player_2_account_id        : int 86011339
##  $ admin_account_id           : int 86011339

get_tournament_player_stats

get_tournament_player_stats provides information about tournament players’ stats. It requires an account_id and optionally a league_id (only the international is supported i.e. 65006), a hero_id or a time_frame (this is not functional just yet according to the Steam API Documentation). The function returns a list that contains information about the matches the player played and information about global stats.

Steam API Documentation: GetTournamentPlayerStats

#request seems to be successful but I couldn't find an account id that returned player stats
str(get_tournament_player_stats(account_id = 89550641, league_id = 65006)$content)
## List of 1
##  $ result:List of 2
##   ..$ status : int 1
##   ..$ matches: list()

get_top_live_game

get_top_live_game returns the top live games by MMR. It requires a partner parameter (not optional) but the API documentation does not specify what it actually is. Values of 1 or 2 or 3 seem to be working. The function returns a games_list list which contains information about the top live games. The following categories are returns for each game. They are not documented on the API:

Steam API Documentation: GetTopLiveGame

#information about one team
str(get_top_live_game(partner = 1)$content$game_list[[1]])
## List of 18
##  $ activate_time   : int 1477827072
##  $ deactivate_time : int 0
##  $ server_steam_id : chr "90104930046802944"
##  $ lobby_id        : chr "24792658995225838"
##  $ league_id       : int 0
##  $ lobby_type      : int 7
##  $ game_time       : int 114
##  $ delay           : int 120
##  $ spectators      : int 787
##  $ game_mode       : int 3
##  $ average_mmr     : int 7556
##  $ sort_score      : int 8843
##  $ last_update_time: int 1477827456
##  $ radiant_lead    : int -998
##  $ radiant_score   : int 0
##  $ dire_score      : int 1
##  $ players         :List of 10
##   ..$ :List of 2
##   .. ..$ account_id: int 107149125
##   .. ..$ hero_id   : int 86
##   ..$ :List of 2
##   .. ..$ account_id: int 111646167
##   .. ..$ hero_id   : int 70
##   ..$ :List of 2
##   .. ..$ account_id: int 162073020
##   .. ..$ hero_id   : int 23
##   ..$ :List of 2
##   .. ..$ account_id: int 156662698
##   .. ..$ hero_id   : int 88
##   ..$ :List of 2
##   .. ..$ account_id: int 137193239
##   .. ..$ hero_id   : int 76
##   ..$ :List of 2
##   .. ..$ account_id: int 230617400
##   .. ..$ hero_id   : int 15
##   ..$ :List of 2
##   .. ..$ account_id: int 139937922
##   .. ..$ hero_id   : int 14
##   ..$ :List of 2
##   .. ..$ account_id: int 167072778
##   .. ..$ hero_id   : int 92
##   ..$ :List of 2
##   .. ..$ account_id: int 182325064
##   .. ..$ hero_id   : int 8
##   ..$ :List of 2
##   .. ..$ account_id: int 210287979
##   .. ..$ hero_id   : int 62
##  $ building_state  : int 4784201

get_game_items

get_game_items returns information about Dota’s items. The function does not require any extra arguments and outputs a data.frame with the following columns:

Steam API Documentation: GetGameItems

str(get_game_items()$content)
## 'data.frame':    281 obs. of  7 variables:
##  $ id            : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ name          : chr  "item_blink" "item_blades_of_attack" "item_broadsword" "item_chainmail" ...
##  $ cost          : int  2250 420 1200 550 1400 900 1500 1600 1400 875 ...
##  $ secret_shop   : int  0 0 0 0 0 0 0 0 1 0 ...
##  $ side_shop     : int  1 1 1 1 0 1 0 0 0 1 ...
##  $ recipe        : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ localized_name: chr  "Blink Dagger" "Blades of Attack" "Broadsword" "Chainmail" ...

get_heroes

get_heroes returns information about Dota’s heroes. The function does not require any extra arguments and outputs a data.frame with the following columns:

Steam API Documentation: GetHeroes

str(get_heroes()$content)
## 'data.frame':    112 obs. of  3 variables:
##  $ name          : chr  "npc_dota_hero_antimage" "npc_dota_hero_axe" "npc_dota_hero_bane" "npc_dota_hero_bloodseeker" ...
##  $ id            : int  1 2 3 4 5 6 7 8 9 11 ...
##  $ localized_name: chr  "Anti-Mage" "Axe" "Bane" "Bloodseeker" ...

get_rarities

get_rarities returns information about Dota’s item rarities. The function does not require any extra arguments and outputs a data.frame with the following columns:

Steam API Documentation: GetRarities

get_rarities()$content
##        name id order   color localized_name
## 1    common  1     0 #b0c3d9         Common
## 2  uncommon  2     1 #5e98d9       Uncommon
## 3      rare  3     2 #4b69ff           Rare
## 4  mythical  4     3 #8847ff       Mythical
## 5 legendary  5     4 #d32ce6      Legendary
## 6   ancient  6     5 #EB4B4B        Ancient
## 7  immortal  7     6 #e4ae39       Immortal
## 8    arcana  8     7 #ADE55C         Arcana

get_tournament_prize_pool

get_tournament_prize_pool returns information about Dota’s tournament prizes. The function can take an optional leagueid argument (the league id to get the prize for) and outputs a data.frame with the following columns:

Steam API Documentation: GetTournamentPrizePool

str(get_tournament_prize_pool()$content)
## 'data.frame':    1 obs. of  2 variables:
##  $ prize_pool: int 2874380
##  $ league_id : int 65006

get_event_stats_for_account

get_event_stats_for_account returns an account’s event stats. The function takes two arguments. An eventid argument (the league id) and an accountid argument (account id to get stats for). A list will be returned but the contents of it are not documented in the Steam API Documentation. The function returns a list that contains:

Steam API Documentation: GetEventStatsForAccount

get_event_stats_for_account(eventid = 65006, accountid = 89550641)$content
## $result
## $result$event_points
## [1] 0
## 
## $result$actions
## named list()

get_item_icon_path

get_item_icon_path returns the icon path for an item. It requires an iconname (The item icon name) and an icontype (the type of image - 0 is normal, 1 is large and 3 is ingame) argument. There is no documentation regarding this method in the Steam API Documentation at the time of writing.

Steam API Documentation: GetItemIconPath

BUGS / FEATURES

If you would like to make any recommendations or give feedback or report a bug please visit the development site on github.

You made it to the end of the documentation! Thanks for reading!