{"id":14069049,"url":"https://github.com/hrbrmstr/speedtest","last_synced_at":"2025-03-21T12:30:53.560Z","repository":{"id":141238824,"uuid":"110290645","full_name":"hrbrmstr/speedtest","owner":"hrbrmstr","description":":triangular_ruler: Measure upload/download speed/bandwidth for your network with R","archived":false,"fork":false,"pushed_at":"2020-03-20T02:09:43.000Z","size":4622,"stargazers_count":65,"open_issues_count":4,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T01:11:13.963Z","etag":null,"topics":["bandwidth","bandwidth-monitor","bandwidth-test","r","r-cyber","rstats"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-10T20:41:26.000Z","updated_at":"2025-01-17T02:20:32.000Z","dependencies_parsed_at":"2024-08-13T07:14:56.116Z","dependency_job_id":"444af39b-984f-4026-bd5d-e37b2fa7304b","html_url":"https://github.com/hrbrmstr/speedtest","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspeedtest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspeedtest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspeedtest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fspeedtest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/speedtest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244799207,"owners_count":20512206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bandwidth","bandwidth-monitor","bandwidth-test","r","r-cyber","rstats"],"created_at":"2024-08-13T07:06:34.277Z","updated_at":"2025-03-21T12:30:52.172Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: rmarkdown::github_document\neditor_options: \n  chunk_output_type: console\n---\n```{r pkg-knitr-opts, include=FALSE}\nhrbrpkghelpr::global_opts()\n```\n\n```{r badges, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::stinking_badges()\n```\n\n# speedtest \n\nTools to Test and Compare Internet Bandwidth Speeds\n\n## Description\n\nThe 'Ookla' 'Speedtest' site \u003chttps://beta.speedtest.net/about\u003e provides interactive and programmatic services to test and compare bandwidth speeds from a source node on the Internet to thousands of test servers. Tools are provided to obtain test server lists, identify target servers for testing and performing speed/bandwidth tests.\n    \n## What's Inside The Tin\n\nThe following functions are implemented:\n\n```{r ingredients, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::describe_ingredients()\n```\n\n## Make a CLI utility\n\nWhile you can run `spd_test()` from an R console, it was desgined to be an easily wrapped into a `bash` (et al) alias or put into a small batch script. Or, you can just type out the following if you're fleet-of-finger/have dexterous digits:\n\n    Rscript --quiet -e 'speedtest::spd_test()'\n    \nwhich will look something like:\n\n![](man/figures/spdtst.gif)\n\n## TODO\n\nFolks interested in contributing can take a look at the TODOs and pick as many as you like! Ones with question marks are truly a \"I dunno if we shld\" kinda thing. Ones with exclamation marks are essentials.\n\n- [ ] Cache config in memory at startup vs pass around to functions?\n- [ ] Figure out how to use beta sockets hidden API vs the old Flash API?\n- [ ] Ensure the efficacy of relying on the cURL timings for speed measures for the Flash API\n- [ ] Figure out best way to capture the results for post-processing\n- [ ] Upload results to speedtest (tis only fair)!\n- [ ] Incorporate more network or host measures for better statistical determination of the best target!\n- [ ] `autoplot` support!\n- [ ] RStudio Add-in\n- [ ] Shiny app?\n\n## Installation\n\n```{r install-ex, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::install_block()\n```\n\n## Usage\n\n```{r libs, cache=FALSE}\nlibrary(speedtest)\nlibrary(stringi)\nlibrary(hrbrthemes)\nlibrary(ggbeeswarm)\nlibrary(tidyverse)\n\n# current verison\npackageVersion(\"speedtest\")\n```\n\n### Download Speed\n\n```{r dl-speeed, cache=TRUE}\nconfig \u003c- spd_config()\n\nservers \u003c- spd_servers(config=config)\nclosest_servers \u003c- spd_closest_servers(servers, config=config)\nonly_the_best_severs \u003c- spd_best_servers(closest_servers, config)\n```\n\n### Individual download tests\n\n```{r individ-dl, cache=TRUE}\nglimpse(spd_download_test(closest_servers[1,], config=config))\n\nglimpse(spd_download_test(only_the_best_severs[1,], config=config))\n```\n\n### Individual upload tests\n\n```{r individ-up, cache=TRUE}\nglimpse(spd_upload_test(only_the_best_severs[1,], config=config))\n\nglimpse(spd_upload_test(closest_servers[1,], config=config))\n```\n\n### Moar download tests\n\nChoose closest, \"best\" and randomly (there can be, and are, some dups as a result for best/closest), run the test and chart the results. This will show just how disparate the results are from these core/crude tests. Most of the test servers compensate when they present the results. Newer, \"socket\"-based tests are more accurate but there are no free/hidden exposed APIs yet for most of them.\n\n```{r moar-dl-tests, cache=TRUE}\nset.seed(8675309)\n\nbind_rows(\n\n  closest_servers[1:3,] %\u003e%\n    mutate(type=\"closest\"),\n\n  only_the_best_severs[1:3,] %\u003e%\n    mutate(type=\"best\"),\n\n  filter(servers, !(id %in% c(closest_servers[1:3,]$id, only_the_best_severs[1:3,]$id))) %\u003e%\n    sample_n(3) %\u003e%\n    mutate(type=\"random\")\n\n) %\u003e%\n  group_by(type) %\u003e%\n  ungroup() -\u003e to_compare\n\nselect(to_compare, sponsor, name, country, host, type)\n\nmap_df(1:nrow(to_compare), ~{\n  spd_download_test(to_compare[.x,], config=config, summarise=FALSE, timeout=30)\n}) -\u003e dl_results_full\n\nmutate(dl_results_full, type=stri_trans_totitle(type)) %\u003e%\n  ggplot(aes(type, bw, fill=type)) +\n  geom_quasirandom(aes(size=size, color=type), width=0.15, shape=21, stroke=0.25) +\n  scale_y_continuous(expand=c(0,5)) +\n  scale_size(range=c(2,6)) +\n  scale_color_manual(values=c(Random=\"#b2b2b2\", Best=\"#2b2b2b\", Closest=\"#2b2b2b\")) +\n  scale_fill_ipsum() +\n  labs(x=NULL, y=NULL, title=\"Download bandwidth test by selected server type\",\n       subtitle=\"Circle size scaled by size of file used in that speed test\") +\n  theme_ipsum_rc(grid=\"Y\") +\n  theme(legend.position=\"none\")\n```\n\n### Moar upload tests\n\nChoose closest and \"best\" and filter duplicates out since we're really trying to measure here vs show the disparity:\n\n```{r moar-ul-tests, cache=TRUE}\nbind_rows(\n  closest_servers[1:3,] %\u003e% mutate(type=\"closest\"),\n  only_the_best_severs[1:3,] %\u003e% mutate(type=\"best\")\n) %\u003e%\n  distinct(.keep_all=TRUE) -\u003e to_compare\n\nselect(to_compare, sponsor, name, country, host, type)\n\nmap_df(1:nrow(to_compare), ~{\n  spd_upload_test(to_compare[.x,], config=config, summarise=FALSE, timeout=30)\n}) -\u003e ul_results_full\n\nggplot(ul_results_full, aes(x=\"Upload Test\", y=bw)) +\n  geom_quasirandom(aes(size=size, fill=\"col\"), width=0.1, shape=21, stroke=0.25, color=\"#2b2b2b\") +\n  scale_y_continuous(expand=c(0,0.5)) +\n  scale_size(range=c(2,6)) +\n  scale_fill_ipsum() +\n  labs(x=NULL, y=NULL, title=\"Upload bandwidth test by selected server type\",\n       subtitle=\"Circle size scaled by size of file used in that speed test\") +\n  theme_ipsum_rc(grid=\"Y\") +\n  theme(legend.position=\"none\")\n```\n\n## speedtest Metrics\n\n```{r cloc, echo=FALSE}\ncloc::cloc_pkg_md()\n```\n\n## Code of Conduct\n\nPlease note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fspeedtest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fspeedtest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fspeedtest/lists"}