{"id":20721,"name":"canwqdata","description":"An R package to download open water quality data from Environment and Climate Change Canada's National Long-term Water Quality Monitoring Data.","url":"https://github.com/bcgov/canwqdata","last_synced_at":"2026-04-11T16:30:36.083Z","repository":{"id":28534231,"uuid":"118661203","full_name":"bcgov/canwqdata","owner":"bcgov","description":"R 📦 to download 🇨🇦 open water quality data","archived":false,"fork":false,"pushed_at":"2025-04-01T23:07:35.000Z","size":711,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-22T04:39:53.722Z","etag":null,"topics":["data-science","env","r","r-package","rlang","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcgov.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2018-01-23T19:51:03.000Z","updated_at":"2025-08-22T21:49:17.000Z","dependencies_parsed_at":"2025-04-17T08:56:36.856Z","dependency_job_id":"6d33bfeb-b912-4c9d-b25c-59b587beca05","html_url":"https://github.com/bcgov/canwqdata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bcgov/canwqdata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov","download_url":"https://codeload.github.com/bcgov/canwqdata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280563577,"owners_count":26351732,"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-10-23T02:00:06.710Z","response_time":142,"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"}},"owner":{"login":"bcgov","name":"bcgov","uuid":"916280","kind":"organization","description":"This is the home for code that is open","email":"Developer.Experience@gov.bc.ca","website":"https://github.com/bcgov/BC-Policy-Framework-For-GitHub","location":"Canada","twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/916280?v=4","repositories_count":2150,"last_synced_at":"2024-12-16T17:13:08.511Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/bcgov","funding_links":[],"total_stars":5184,"followers":687,"following":0,"created_at":"2022-11-05T11:06:51.523Z","updated_at":"2024-12-16T17:13:08.511Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov/repositories"},"packages":[],"commits":{"id":1254531,"full_name":"bcgov/canwqdata","default_branch":"master","total_commits":107,"total_committers":5,"total_bot_commits":3,"total_bot_committers":1,"mean_commits":21.4,"dds":0.28971962616822433,"past_year_total_commits":25,"past_year_total_committers":1,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":25.0,"past_year_dds":0.0,"last_synced_at":"2025-12-01T21:56:57.368Z","last_synced_commit":"b91a4be9c0253c70dcf922c19008a7d2ac577425","created_at":"2023-03-27T11:49:32.050Z","updated_at":"2025-12-01T21:56:45.021Z","committers":[{"name":"Andy Teucher","email":"andy.teucher@gov.bc.ca","login":"ateucher","count":76},{"name":"szy-al","email":"Zhuoyan.Song@gov.bc.ca","login":"szy-al","count":25},{"name":"repo-mountie[bot]","email":"44246292+repo-mountie[bot]","login":"repo-mountie[bot]","count":3},{"name":"stephhazlitt","email":"stephanie.hazlitt@gov.bc.ca","login":"stephhazlitt","count":2},{"name":"KarHarker","email":"karly.harker@gov.bc.ca","login":"KarHarker","count":1}],"past_year_committers":[{"name":"szy-al","email":"Zhuoyan.Song@gov.bc.ca","login":"szy-al","count":25}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2025-12-01T00:00:26.979Z","repositories_count":6119955,"commits_count":925524055,"contributors_count":36021289,"owners_count":1120422,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"bcgov/canwqdata","html_url":"https://github.com/bcgov/canwqdata","last_synced_at":"2025-09-01T03:33:19.598Z","status":"error","issues_count":5,"pull_requests_count":4,"avg_time_to_close_issue":4726021.4,"avg_time_to_close_pull_request":393759.75,"issues_closed_count":5,"pull_requests_closed_count":4,"pull_request_authors_count":3,"issue_authors_count":2,"avg_comments_per_issue":0.6,"avg_comments_per_pull_request":1.5,"merged_pull_requests_count":4,"bot_issues_count":4,"bot_pull_requests_count":2,"past_year_issues_count":0,"past_year_pull_requests_count":1,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":1612.0,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":1,"past_year_pull_request_authors_count":1,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":0.0,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":1,"created_at":"2023-05-09T10:36:06.101Z","updated_at":"2025-09-01T03:33:19.599Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fcanwqdata/issues","issue_labels_count":{},"pull_request_labels_count":{},"issue_author_associations_count":{"CONTRIBUTOR":5},"pull_request_author_associations_count":{"CONTRIBUTOR":3,"MEMBER":1,"NONE":1},"issue_authors":{"repo-mountie[bot]":4,"KarHarker":1},"pull_request_authors":{"szy-al":2,"repo-mountie[bot]":2,"ateucher":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2025-11-28T00:00:08.514Z","repositories_count":11863701,"issues_count":35467621,"pull_requests_count":115719016,"authors_count":11047150,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{},"past_year_pull_request_author_associations_count":{"NONE":1,"CONTRIBUTOR":1},"past_year_issue_authors":{},"past_year_pull_request_authors":{"szy-al":2},"maintainers":[{"login":"ateucher","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ateucher"}],"active_maintainers":[]},"events":{"total":{"PushEvent":6,"PullRequestEvent":2,"CreateEvent":1},"last_year":{"PushEvent":6,"PullRequestEvent":2,"CreateEvent":1}},"keywords":["data-science","env","r","r-package","rlang","rstats"],"dependencies":[{"ecosystem":"cran","filepath":"DESCRIPTION","sha":null,"kind":"manifest","created_at":"2022-08-07T13:16:01.497Z","updated_at":"2022-08-07T13:16:01.497Z","repository_link":"https://github.com/bcgov/canwqdata/blob/master/DESCRIPTION","dependencies":[{"id":598387380,"package_name":"dplyr","ecosystem":"cran","requirements":"\u003e= 0.7","direct":true,"kind":"imports","optional":false},{"id":598387381,"package_name":"httr","ecosystem":"cran","requirements":"\u003e= 1.3","direct":true,"kind":"imports","optional":false},{"id":598387382,"package_name":"memoise","ecosystem":"cran","requirements":"\u003e= 1.1","direct":true,"kind":"imports","optional":false},{"id":598387383,"package_name":"readr","ecosystem":"cran","requirements":"\u003e= 1.1","direct":true,"kind":"imports","optional":false},{"id":598387384,"package_name":"rvest","ecosystem":"cran","requirements":"\u003e= 0.3","direct":true,"kind":"imports","optional":false},{"id":598387385,"package_name":"stats","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":598387386,"package_name":"xml2","ecosystem":"cran","requirements":"\u003e= 1.1","direct":true,"kind":"imports","optional":false},{"id":598387387,"package_name":"knitr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":598387388,"package_name":"rmarkdown","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":598387389,"package_name":"testthat","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":598387390,"package_name":"covr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check.yaml","sha":null,"kind":"manifest","created_at":"2025-04-17T08:56:36.182Z","updated_at":"2025-04-17T08:56:36.182Z","repository_link":"https://github.com/bcgov/canwqdata/blob/master/.github/workflows/R-CMD-check.yaml","dependencies":[{"id":22722113181,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":22722113182,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":22722113183,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":22722113184,"package_name":"r-lib/actions/setup-tinytex","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":22722113308,"package_name":"actions/cache","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false},{"id":22722113309,"package_name":"actions/upload-artifact","ecosystem":"actions","requirements":"v4","direct":true,"kind":"composite","optional":false}]}],"score":4.174387269895637,"created_at":"2023-09-11T14:52:14.930Z","updated_at":"2026-04-11T16:30:36.096Z","avatar_url":"https://github.com/bcgov.png","language":"R","category":"Natural Resources","sub_category":"Water Supply and Quality","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"---\noutput: github_document\n---\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"tools/readme/\", \n  message = FALSE\n)\n```\n\n\u003c!-- badges: start --\u003e\n[![img](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)\n[![Travis-CI Build Status](https://travis-ci.org/bcgov/canwqdata.svg?branch=master)](https://travis-ci.org/bcgov/canwqdata)[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![R build status](https://github.com/bcgov/canwqdata/workflows/R-CMD-check/badge.svg)](https://github.com/bcgov/canwqdata/actions?workflow=R-CMD-check)\n[![Codecov test coverage](https://codecov.io/gh/bcgov/canwqdata/branch/master/graph/badge.svg)](https://codecov.io/gh/bcgov/canwqdata?branch=master)\n\u003c!-- badges: end --\u003e\n\n\n# canwqdata\n\nAn R `r emo::ji(\"package\")`  to download open water quality data from Environment and Climate Change Canada's [National Long-term Water Quality Monitoring Data](http://donnees.ec.gc.ca/data/substances/monitor/national-long-term-water-quality-monitoring-data/).\n\n### Features\n\nThis package is designed to get Canadian Water Quality Monitoring data into R quickly and easily. You can get data from a single monitoring station, multiple stations, or from an entire basin. Note that current version of this package can only retrieve data from BC, not from other provinces.\n\n### Installation\n\n```r\nremotes::install_github(\"bcgov/canwqdata\")\n```\n\n### Usage\n\nFirst load the package:\n\n```{r}\nlibrary(canwqdata)\nlibrary(tidyverse)\n```\n\n\nThe first thing you will probably want to do is get a list of the available BC sites and associated metadata:\n\n```{r}\nsites \u003c- wq_sites()\n\nsites\n```\n\nThen get some data from a particular station:\n\n`BC08EF0001` is a site in BC called *`r tools::toTitleCase(tolower(sites$SITE_NAME[sites$SITE_NO == \"BC08EF0001\"]))`*\n\n```{r}\nskeena_river \u003c- wq_site_data(\"BC08EF0001\")\n\nskeena_river\n```\n\nWe can also get data from more than one station:\n\n```{r}\nwq_site_data(c(\"BC08NF0001\", \"BC08NM0160\"))\n```\n\nOr an entire basin:\n\nThe basins are in the `PEARSEDA` column of the data.frame returned by `wq_sites()`:\n\n```{r}\nbasins \u003c- sort(unique(sites$PEARSEDA))\nbasins\n\nfraser \u003c- wq_basin_data(\"FRASER-LOWER MAINLAND\")\n```\n\nDo some quick summary stats of the fraser dataset:\n\n```{r}\nlibrary(dplyr)\n\nfraser %\u003e% \n  group_by(SITE_NO) %\u003e% \n  summarise(first_date = min(DATE_TIME_HEURE), \n            latest_date = max(DATE_TIME_HEURE), \n            n_params = length(unique(VARIABLE)), \n            total_samples = n())\n```\n\n\nWe can also look at metadata that helps us understand what is in the different columns.\n\n`wq_params()` returns a list of water quality parameters (variables), and related data - units, methods, codes, etc:\n\n```{r}\nparams \u003c- wq_params()\nglimpse(params)\n\n# wq_param_desc shows the column headings (in all other tables) and what they mean\nwq_data_desc() %\u003e% \n  glimpse()\n```\n\nLet's look at Total Nitrogen in the Fraser basin:\n\n```{r}\nfraser_n_total \u003c- fraser %\u003e% filter(VARIABLE == \"NITROGEN TOTAL\")\n```\n\nNow lets do some plotting - plot Total Nitrogen over time at all the sites, \n(plot it on a log scale so that they all fit)\n\n```{r}\nlibrary(ggplot2)\n\nggplot(fraser_n_total, aes(x = DATE_TIME_HEURE, y = VALUE_VALEUR)) + \n  geom_point(size = 0.4, alpha = 0.4, colour = \"purple\") + \n  facet_wrap(~ SITE_NO) + \n  scale_y_log10()\n```\n\n\nIt's also possible to download data from an entire BC:\n\n```{r}\nbc_sites \u003c- sites %\u003e% \n  pull(SITE_NO)\n\nall_bc_data \u003c- wq_site_data(bc_sites)\n\nglimpse(all_bc_data)\n```\n\n### Project Status\n\nUnder development, but ready for use and testing.\n\n### Getting Help or Reporting an Issue\n\nTo report bugs/issues/feature requests, please file an [issue](https://github.com/bcgov/canwqdata/issues/).\n\n### How to Contribute\n\nIf you would like to contribute to the package, please see our \n[CONTRIBUTING](CONTRIBUTING.md) guidelines.\n\nPlease note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.\n\n### License\n\n    Copyright 2025 Province of British Columbia\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at \n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\nThis repository is maintained by [Environmental Reporting BC](http://www2.gov.bc.ca/gov/content?id=FF80E0B985F245CEA62808414D78C41B). Click [here](https://github.com/bcgov/EnvReportBC-RepoList) for a complete list of our repositories on GitHub.\n","funding_links":[],"readme_doi_urls":[],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":["flnr","soe","citz","species-sensitivity-distribution","bcdc"],"project_url":"https://ost.ecosyste.ms/api/v1/projects/20721","html_url":"https://ost.ecosyste.ms/projects/20721"}