{"id":23111509,"url":"https://github.com/quant-aq/r-quantaq","last_synced_at":"2025-12-24T21:06:25.113Z","repository":{"id":77497647,"uuid":"187944777","full_name":"quant-aq/r-quantaq","owner":"quant-aq","description":"The official R wrapper for the QuantAQ API","archived":false,"fork":false,"pushed_at":"2023-12-13T18:41:59.000Z","size":76,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-17T02:03:43.375Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quant-aq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-05-22T02:06:09.000Z","updated_at":"2023-09-11T15:06:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"abeca6b5-922c-4245-ba92-d8481ccddffc","html_url":"https://github.com/quant-aq/r-quantaq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/quant-aq/r-quantaq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quant-aq%2Fr-quantaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quant-aq%2Fr-quantaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quant-aq%2Fr-quantaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quant-aq%2Fr-quantaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quant-aq","download_url":"https://codeload.github.com/quant-aq/r-quantaq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quant-aq%2Fr-quantaq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28008452,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-17T02:01:51.166Z","updated_at":"2025-12-24T21:06:25.097Z","avatar_url":"https://github.com/quant-aq.png","language":"R","funding_links":[],"categories":["Software Libraries"],"sub_categories":[],"readme":"# r-quantaq\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/christopherDT/r-quantaq/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/christopherDT/r-quantaq/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nAn R wrapper for the QuantAQ RESTful API.\n\n**NOTE**:\nAs of Aug 30th, 2023, this package is in **active development** and will be updated in potentially breaking ways until the first release.\n\n# Installation\n\nCurrently, you must install directly from GitHub:\n\n```R\n# If you don't have devtools installed:\ninstall.packages(\"devtools\")\n\n# Install the library from GitHub\ndevtools::install_github(repo=\"quant-aq/r-quantaq\")\n```\n\n\n# Docs\n\nComplete documentation is available [here](). A quick-start guide follows:\n\n# Getting Started\n\nTo use `r-quantaq`, import it:\n\n```R\nlibrary(\"QuantAQAPIClient\")\n```\n\n## Authentication\n\nTo use the QuantAQ API, you must have an API key. To obtain an API key, please follow the instructions [here](https://docs.quant-aq.com/api#541cc94f0c3a41abbb0200b69bb8d9e2).\n\nTo begin, call `setup_client()` to set your API Key. By passing `verbose = TRUE`, you will receive a message on successful connection to the API. It's possible, but not recommended, to include your API Key in the function as an argument, (i.e., `setup_client(api_key = \u003cyour api key here\u003e)`). We recommend that RStudio users call `setup_client()` without arguments, and RStudio will use its automatic secret key manager. You can then follow the prompt to install the keyring package, which saves the key so you don't have to enter it every time.\n\n## Utility Functions\n\nTo receive data as a dataframe (rather than json), you can use the `as.data.frame` function:\n\n```R\n# Return data as a dataframe\nas.data.frame(get_data(\"\u003cserial-number\u003e\"))\n\n# Pipe it through\nget_data(\"\u003cserial-number\u003e\") %\u003e% as.data.frame()\n```\n\n\n## Basic Functions\n\n### `whoami()`\n\n`whoami()` returns your basic account information.\n\n```R\n# Get your account information\naccount \u003c- whoami()\n```\n\n### `get_data(sn, limit=100, start=NULL, stop=NULL, filter=NULL, sort=NULL, raw=FALSE)`\n\nReturn all data for a device by its serial number. \n\n```R\n# Get the data for a device with all defaults\nx \u003c- as.data.frame(get_data(\"\u003cserial-number\u003e\"))\n\n# Get the first 10 records for a device \nx \u003c- as.data.frame(get_data(\"\u003cserial-number\u003e\", limit=10))\n\n# Get the raw data\nx \u003c- as.data.frame(get_data(\"\u003cserial-number\u003e\", raw=TRUE))\n```\n\n### `get_organizations(organization_id=NULL)`\n\nReturn a list of all organizations you can view,\nor the particular organization with id=organization_id.\n\n```R\n# Get the list of organizations\nx \u003c- get_organizations()\n```\n\n### `get_networks(organization_id, network_id=NULL)`\n\nReturn a list of all networks you can can view in\nthe context of the particular organization with id=organization_id,\nor the particular network with id=network_id within that organization.\n\n```R\n# Get the list of networks in organization 1\nx \u003c- get_networks(organization_id = 1)\n```\n\n### `get_devices(sn=NULL, limit=NULL, sort=NULL)`\n\nGet a list of all devices you have access to.\n\n```R\n# Get a list of the first 25 devices as a dataframe\nx \u003c- as.data.frame(get_devices(limit=25))\n```\n\n### `get_data_by_date(sn, date, raw=FALSE)`\n\nReturn the data for a device by the date. This is the most efficient way to grab a lot of data as it is cached and ready to download.\n\n```R\n# Get the data for date as a dataframe\nx \u003c- as.data.frame(get_data_by_date(\"\u003cserial-number\u003e\", \"2023-08-30\"))\n\n# Get the raw data for date as a dataframe\nx \u003c- as.data.frame(get_data_by_date(\"\u003cserial-number\u003e\", \"2023-08-30\", raw=TRUE))\n```\n\n## Advanced Queries\n\nAdvanced requests are available by named keywords, examples below. See the [API docs](https://docs.quant-aq.com/api#1bcd5e949cb74e63ab25d214d600e1af) for more information.\n\n## Filter\nFormat as `filter = '\u003cparameter\u003e,\u003cfilter spec\u003e,\u003cvalue\u003e;\u003cparameter\u003e,\u003cfilter spec\u003e,\u003cvalue\u003e;'`. Append as many filters as desired.\n\n```R\n# returns data where pm25 \u003e= 25 and \u003c= 50\nget_data(\"\u003cserial-number\u003e\", filter = 'pm25,ge,25;pm25,le,50') \n\n# returns only data where device is on, i.e. device_state == ACTIVE\nget_data(\"\u003cserial-number\u003e\", filter = \"device_state,eq,ACTIVE\") \n```\n\n## Limit \nFormat as `limit = \u003cvalue\u003e`.\n\n```R\n# returns 25 devices\nget_devices(limit = 25) \n\n# returns first 10 timestamps of data\nget_data(\"\u003cserial-number\u003e\"), limit = 10) \n```\n\n## Sort\n\nInclude `sort = '\u003cparameter\u003e\u003corder\u003e'`, where 'order' is one of \"asc\" or \"desc\".\n\n```R\n# returns data in descending order by timestamp\nget_data(\"\u003cserial-number\u003e\"), sort = 'timestamp,desc') \n```\n\n\n\n\n, and each `get_` function GETs the data from its similarly-named API endpoint. Each of these can be piped or passed to `as.data.frame` for nicer formatting, e.g. to get data from device serial number `MOD-PM-00233`:\n\n\n\n# Development\n\nTests are run automatically when pull requests are made against the `main` branch via a github action. To run locally:\n\n```R\ndevtools::test()\n```\n\nTo build a new version of the docs pdf:\n\n```R\ndevtools::document() # in case any changes were made to the documentation in the code\ndevtools::build_manual() # to build the pdf\n```\n\nTo contribute to this library, please submit a pull request with documentation and notes about what changed and why. Please be as descriptive as possible, add tests where necessary, and add an appropriate label. A QuantAQ maintainer will review and merge PRs as they are received.\n\nIf you notice any bugs or have questions about this library, please create an Issue using the GitHub Issues feature.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquant-aq%2Fr-quantaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquant-aq%2Fr-quantaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquant-aq%2Fr-quantaq/lists"}