test the speed of the hashmap and vector methods of looking up stats several possible syntax options for the vector lookup are tested run a benchmark that compares the speed and accuracy of hashmap and named vectors for the needs of nflscrapR nfl_stat_map is used once, in a situation where it only looks up scalar values that are always hits in nflscrapR, the stats are force cast to character beforehand so included a test that shows the cost of doing so as well as a test where the cost of doing so is not included the == notation matches functionality only under those conditions, while match should perform in the event of a non match or you want to look up a vector of stat ids.
1 | hashmap_vs_vector_test(number_of_trials = 10000)
|
number_of_trials |
number of microbenchmark trials to run. 10000 is the default |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.