From 7cb3866b14b91221a91cd8d624fc16f392ce2a18 Mon Sep 17 00:00:00 2001 From: Richard Martin-Nielsen Date: Sat, 29 Jan 2022 09:37:28 +0200 Subject: [PATCH] Squashed commit of the following: commit 097708f8daf236b6f493a663832382e7f60b5e8d Merge: 950e6250 1a99fa77 Author: Sam Abbott Date: Fri Dec 10 21:43:52 2021 +0000 Merge pull request #444 from epiforecasts/Bisaloo-patch-1 Fix website URL commit 1a99fa7700d076a123c480be0b36762d9eab414c Author: Hugo Gruson Date: Fri Dec 3 17:04:19 2021 +0000 Fix website URL commit 950e62508fc774136fd227749620071aa6eebc13 Author: Sam Abbott Date: Fri Dec 3 16:37:48 2021 +0000 Update NEWS.md commit b93e19dcb1e39b67828c3e4b6038cbf2b158ef1d Merge: f6c97599 007b5358 Author: Sam Abbott Date: Fri Dec 3 16:36:05 2021 +0000 Merge pull request #437 from epiforecasts/fewer-deps Reduce the number of `Imports` commit f6c97599f77750cb0f70a6f4fa48afb72d6db5ad Merge: 4509d81e ac3e63ec Author: Sam Abbott Date: Fri Dec 3 16:33:49 2021 +0000 Merge pull request #439 from epiforecasts/pr-checklist-news Update pr-checklist.yaml to include news nudge commit 4509d81e9f6e0496066d4a84a9f46a27e500a921 Merge: 04009e71 b24f2b68 Author: Sam Abbott Date: Fri Dec 3 16:33:08 2021 +0000 Merge pull request #429 from epiforecasts/alternate-switzerland New data source for Switzerland - fix for #412 commit b24f2b6848096415a6b24065c6ceaca413f722cd Author: Richard Martin-Nielsen Date: Wed Dec 1 19:50:08 2021 +0200 Update all_country_data.rda commit ed0f6c07242f498e42d89becbe37356183c7fa00 Author: Richard Martin-Nielsen Date: Wed Dec 1 19:36:35 2021 +0200 Fixed documentation links to FOPH as source of Switzerland data, updated News commit 2a7f105701e0389b8da2192ae122c7bb5fa48a00 Merge: aea9b96c 04009e71 Author: Sam Abbott Date: Wed Dec 1 15:23:21 2021 +0000 Merge branch 'master' into alternate-switzerland commit 04009e7157970b5abe68acb1d8aa07242e82d8b0 Merge: d1630f56 68200f9b Author: Sam Abbott Date: Wed Dec 1 14:27:05 2021 +0000 Merge pull request #443 from epiforecasts/feature-boostrap-5-in-docs Switch to bootstrap 5 for pkgdown commit 68200f9bf7a9f359ce3757ebc00ab233766dc624 Author: Sam Abbott Date: Wed Dec 1 13:52:07 2021 +0000 switch to bootstrap 5 for pkgdown commit d1630f564618840e3ea6941fbebfdba43d1fbe3e Merge: 71d7b1f1 ddbdb8e8 Author: Sam Abbott Date: Wed Dec 1 13:48:12 2021 +0000 Merge pull request #442 from epiforecasts/fix-logo Fix giant logo by specifying width instead of height commit ddbdb8e8301c76facdb7da662ed533df3c811f1d Merge: a19643ff 71d7b1f1 Author: Sam Abbott Date: Wed Dec 1 13:47:52 2021 +0000 Merge branch 'master' into fix-logo commit a19643ff780775a8a3bfc6c4b7813000038fc9af Author: Hugo Gruson Date: Wed Dec 1 14:30:11 2021 +0100 Fix giant logo by specifying width instead of height fix #440 commit aea9b96cc826d394ed2a5fd01e1ff733ee3b913a Merge: 0d8a6e5e 71d7b1f1 Author: Sam Abbott Date: Wed Dec 1 10:52:16 2021 +0000 Merge branch 'master' into alternate-switzerland commit ac3e63ec42f9e87f69e78011b3aa675bca077229 Author: Sam Abbott Date: Wed Dec 1 10:42:33 2021 +0000 Update pr-checklist.yaml commit 71d7b1f129ae397eb528dd75757de8d4c4fa8afb Merge: 2e5cabc1 fb10488e Author: Sam Abbott Date: Wed Dec 1 10:21:14 2021 +0000 Merge pull request #438 from epiforecasts/rm-joss-action Remove action re-building JOSS paper commit 007b5358492ee18bffc71df595c151bf79687671 Author: Hugo Gruson Date: Wed Dec 1 10:43:26 2021 +0100 Run devtools::document() commit fe79373581296f55cba7b00b92b6cfdbc4273da2 Author: Hugo Gruson Date: Wed Dec 1 10:43:16 2021 +0100 Get rid of tidyselect commit 3f5c1158d9c2322b2901b564637c1c612188d8a9 Author: Hugo Gruson Date: Wed Dec 1 10:27:44 2021 +0100 Remove withr dependency as well commit fb10488e23a87ab4ee55fd2c5965ac80e44a35ca Author: Hugo Gruson Date: Tue Nov 30 19:09:00 2021 +0100 Remove action re-building JOSS paper commit 79857e9f30b65453d28a0bb2463147f460b643f2 Author: Hugo Gruson Date: Tue Nov 30 19:03:17 2021 +0100 Use dplyr::tibble in tests as well commit d3c150b155c1f56689f7c380c9c952db7941e3c3 Author: Hugo Gruson Date: Tue Nov 30 18:59:59 2021 +0100 Remove broken rlang::.data import to prevent it from being understood as a re-export commit e711456b9b87891790591c4840f1245ed446f5bc Author: Hugo Gruson Date: Tue Nov 30 12:53:15 2021 +0100 Run devtools::document() commit 4032abd72fde4d729cad65c0decb7766de12dfc4 Author: Hugo Gruson Date: Tue Nov 30 12:43:43 2021 +0100 Use stringr everywhere instead of stringi commit 1c4ede02a1e4761e3976971c6642dcfc16567f3b Author: Hugo Gruson Date: Tue Nov 30 12:34:20 2021 +0100 Get tibble functions from dplyr commit a499cc09daddbff9bacb8c72c26a451075af7adc Author: Hugo Gruson Date: Tue Nov 30 12:10:05 2021 +0100 Re-export pipe from dplyr commit 2e5cabc18dae7d6d24d728c49f19e4c92759981b Author: Sam Abbott Date: Mon Nov 29 13:43:29 2021 +0000 Update NEWS.md commit d1350d9a88572e0a33804e886fffa24eef69ba41 Merge: 8c77b825 782256cd Author: Sam Abbott Date: Mon Nov 29 13:41:00 2021 +0000 Merge pull request #436 from epiforecasts/fix-germany fix Germany case/death data commit 782256cdbe98d8246376a80392ea3e7fad5de038 Author: Sebastian Funk Date: Mon Nov 29 07:40:01 2021 +0000 add missing sum commit 4c7cb8c0d74205e664399b38a780cd62de768667 Author: Sebastian Funk Date: Mon Nov 29 07:19:09 2021 +0000 fix Germany case/death data commit 8c77b825d0607e8a836a4f525b39a11ce1a01af0 Author: Sam Abbott Date: Tue Oct 12 10:20:55 2021 +0100 Check package once a week vs daily commit 0d8a6e5e3b8688b491f16b1b9574e7288fa41133 Author: Richard Martin-Nielsen Date: Mon Oct 11 22:19:24 2021 +0300 Fixes to keep lintr happier commit 4eb12da9adef21a1f219a84c0e8524f5368014a4 Author: Richard Martin-Nielsen Date: Mon Oct 11 22:05:46 2021 +0300 Cleaning code added and running. Passes tests. Removed AltSwitzerland code, generated data file of sample data and list of data sets. commit 76e4c4454dc4836408ec2ca110f4940da71308a8 Author: Richard Martin-Nielsen Date: Mon Oct 4 22:16:44 2021 +0300 Moved old Switzerland code to SwitzerlandAlt, written functional 2-stage download method commit b5b9cbf7b2aa19d5490294f417f3badaeb3a2bb0 Merge: c782b57b 91d0f0c8 Author: Sam Abbott Date: Thu Sep 30 13:01:56 2021 +0100 Merge pull request #428 from RichardMN/update-Vietnam-url-and-docs Update vietnam url and docs commit 91d0f0c807804ba7cbe78d09b68b5e3a92613f5e Author: Richard Martin-Nielsen Date: Thu Sep 30 09:12:37 2021 +0300 Rebuilt all country data table and Vietnam documentation commit 1d6c02485db643a681ac2d57c80ed0250a6108e1 Author: Tri Luu Date: Thu Sep 30 09:38:37 2021 +0700 Update stable API URL of Vietnam commit c782b57bb840f8b9f34336c495496ee3c91f09f6 Author: seabbs Date: Tue Sep 28 09:17:04 2021 +0000 update hex and docker hex deps commit 73784b73163389da56331b9b53202fbc2b7c27ff Merge: c59154db d1232f1f Author: Sam Abbott Date: Mon Sep 27 14:11:00 2021 +0100 Merge pull request #413 from biocyberman/vietnam Add subnational data for Vietnam commit d1232f1ff1f3d096ac8953194003cd654d850883 Author: seabbs Date: Mon Sep 27 11:52:46 2021 +0000 update description, news and run tests commit b3af1a6dd03c9c6f995611a2e6856ceaf5fc225a Merge: 4b266751 c59154db Author: seabbs Date: Mon Sep 27 11:34:25 2021 +0000 fix merge issues commit c59154dba17b66eaeba83e26e6b5a50d7e504012 Author: seabbs Date: Mon Sep 27 11:28:14 2021 +0000 add precommit initialisation to vscode devcontainer commit c9d5b19559633d38e3322ccb4fe9e0083a640e2f Author: seabbs Date: Mon Sep 27 11:27:07 2021 +0000 update dockerfile for new deps commit 8401fc89f95607febae66a5589ebc801029b4916 Merge: aa85f36c da185c9c Author: Sam Abbott Date: Mon Sep 27 11:27:16 2021 +0100 Merge pull request #417 from epiforecasts/estonia-data Add Estonia data commit 4b26675107f2a67eafd598d25f45f978f8002e3c Author: Sam Abbott Date: Mon Sep 20 11:06:33 2021 +0100 Update DESCRIPTION commit 9c35694df1cf9c5d77176f94febfd5a2014e1288 Author: Richard Martin-Nielsen Date: Sun Sep 19 21:23:51 2021 +0300 lint cleaning commit 26cd8ad718d694ccf835b9354128e15a10251ff1 Author: Richard Martin-Nielsen Date: Sun Sep 19 21:19:07 2021 +0300 Remove prefixes in vietnam_codes.R commit 2c20067c5b8199ffe53b8781b1784654d1ee2c0e Author: Richard Martin-Nielsen Date: Sun Sep 19 20:02:55 2021 +0300 JSON-reading implementation of Vietnam Uses download_json method for downloading. Adjustment to the DataClass tests to deal with tables of lists. Addition of stringi to imported packages, and of fromJSON and jsonlinte to the WORDLIST. Tests run and data stored. commit f0cec88b2d20f1a1e225992a71dc02706914df4b Merge: 5f7e82e4 5681a2cb Author: Richard Martin-Nielsen Date: Sun Sep 19 19:02:02 2021 +0300 Merge branch 'json-reader-vietnam' into pr/413 commit 5f7e82e4251a15a5cc56491a67ba14530afaad1d Merge: b54bd033 abf4cdd6 Author: Richard Martin-Nielsen Date: Sun Sep 19 18:56:41 2021 +0300 Merge branch 'json-reader' into pr/413 commit 5681a2cb09f845c1b83e4bdc0b597a5d04008be8 Author: Richard Martin-Nielsen Date: Fri Sep 17 22:04:01 2021 +0300 Fixing final glitches in clean_common commit 3aeddbea6378f044abab394ea4877e8d9b3ff742 Author: Richard Martin-Nielsen Date: Fri Sep 17 21:40:09 2021 +0300 Closer to a tidy version of cleaning Vietnam data commit da185c9cde6c3196e63ada281900df220bdf070f Author: Sam Abbott Date: Fri Sep 17 16:51:23 2021 +0100 Update DESCRIPTION commit 27f77f187e11694728bd4b9225086a2daa08f37f Author: Sam Abbott Date: Fri Sep 17 16:51:09 2021 +0100 Update NEWS.md commit fc0d356c95daeee7a6ad4dca0a5d4fa1f7984396 Author: Sam Abbott Date: Fri Sep 17 16:50:56 2021 +0100 bump news commit 7bd4fb00f6e44bebe0bf01a10125176813e6e28e Author: Richard Martin-Nielsen Date: Thu Sep 16 21:43:23 2021 +0300 Using JSON reader to download Vietnam code commit aff8dbdb21b9bfccfba074ceb77d14c4e092f87e Author: Richard Martin-Nielsen Date: Thu Sep 16 20:41:16 2021 +0300 Add Estonia.yaml commit cab4d9713c779e424536779592e37c06d5dd4905 Merge: 24bd6686 1426e7ad Author: Richard Martin-Nielsen Date: Thu Sep 16 20:38:40 2021 +0300 Merge branch 'estonia-data' of https://github.com/epiforecasts/covidregionaldata into estonia-data commit 24bd6686e77a4a0fc61dd8599a169d4fbdf7e662 Author: Richard Martin-Nielsen Date: Thu Sep 16 20:33:41 2021 +0300 Transfer Estonia code into new clean branch commit 1426e7ad63e8a27273d8cc667b51d69a8ba57832 Author: Richard Martin-Nielsen Date: Thu Sep 16 20:33:41 2021 +0300 Transfer Estonia code into new clean branch commit abf4cdd6b18aff062aa97a2b95809d644f8409f1 Author: Richard Martin-Nielsen Date: Thu Sep 16 20:24:28 2021 +0300 Initial implementation of a generic json_reader function and download_JSON method commit b54bd033a9310fa5731bc28564d0704fd7821937 Author: Richard Martin-Nielsen Date: Thu Sep 16 19:57:23 2021 +0300 Reformatting of code commit ce5de11f3ea94031acb15e5f544e74c3f72754ca Merge: 0f0cafb4 29070dd0 Author: Richard Martin-Nielsen Date: Thu Sep 16 19:29:49 2021 +0300 Merge branch 'vietnam' of https://github.com/biocyberman/covidregionaldata into pr/413 commit 29070dd0429e7bb674f73e5eee198915b2e9661a Author: biocyberman Date: Wed Sep 15 21:36:40 2021 +0200 Refactor code for PR #413 commit 7ca169a96f4764a4e5ee6fa49a30c8e8d00ea5f5 Author: biocyberman Date: Mon Sep 13 19:09:18 2021 +0200 Change data source for Vietnam commit 7edc95c9ca154cff70ce29451ddb72eb84c57844 Author: biocyberman Date: Mon Sep 13 00:31:35 2021 +0200 Update with cases_death from 5F team commit cd25e34047b3010b978d583b35535a31845cd37a Author: biocyberman Date: Thu Sep 2 21:17:11 2021 +0200 Add empty locations to Unknown commit abcd78ab0cbbaf7203480a8d96a20515af4cddb9 Author: biocyberman Date: Sat Aug 28 23:29:05 2021 +0200 Add priliminary support for Vietnam subnational data commit 0f0cafb4751a4599037f59a1bf88ee6e9dc0e660 Author: Vang Le-Quy Date: Mon Sep 13 19:09:18 2021 +0200 Change data source for Vietnam commit a66539fc6104f126ece19ca50b4ce4a71ec78edd Author: Vang Le-Quy Date: Mon Sep 13 00:31:35 2021 +0200 Update with cases_death from 5F team commit 4f57d0f14cd5158889a7f7d9761c8d6898db5df0 Author: Vang Le-Quy Date: Thu Sep 2 21:17:11 2021 +0200 Add empty locations to Unknown commit 89969775f950f2ed7f74d7b9c0db8e97131f4be9 Author: Vang Le-Quy Date: Sat Aug 28 23:29:05 2021 +0200 Add priliminary support for Vietnam subnational data commit aa85f36ca203d3f5bce046775469e0a24bbc3364 Merge: 4a05152e 63c5638d Author: Sam Abbott Date: Mon Aug 9 10:11:59 2021 +0100 Merge pull request #407 from epiforecasts/sshh-bot Make bot less bossy commit 63c5638df8dc066a4f0775c0ec4a33da613352d6 Merge: a519d494 4a05152e Author: Sam Abbott Date: Fri Aug 6 15:01:09 2021 +0100 Merge branch 'master' into sshh-bot commit 4a05152e0d71862e6b46e55e6ed4b59add7d41df Author: Sam Abbott Date: Fri Aug 6 14:23:10 2021 +0100 roll back to dev pkgdown commit a519d494fd73a8e559f394704e288dffdc57e43c Author: Sam Abbott Date: Fri Aug 6 14:20:41 2021 +0100 make bot less bossy commit 66da16e9b781e4f67affbcf45328757949da211b Author: Sam Abbott Date: Fri Aug 6 12:43:15 2021 +0100 use CRAN pkgdown commit 0baa18cc320fce9c2105a9de374bb41667c1c861 Merge: 28d70a0b 41d22581 Author: Sam Abbott Date: Thu Jul 15 17:42:44 2021 +0100 Merge pull request #402 from epiforecasts/fix-readme-citation Fixes citation by rebuilding readme commit 41d22581df8f2bb8d9a21ae4a4eb67e7a26017be Author: seabbs Date: Thu Jul 15 10:44:02 2021 +0000 moves doi badges around commit fe21a13e54ed6901f5c8b7d3a6b4934acb88f530 Author: seabbs Date: Thu Jul 15 10:39:59 2021 +0000 fixes citation by rebuilding readme commit 28d70a0b0d74c45297d3949b2a781d7bfe4f3b9a Merge: 2e0bb8b0 63b0d55e Author: Sam Abbott Date: Thu Jul 15 11:23:14 2021 +0100 Merge pull request #401 from epiforecasts/create-discord added link to discord chat in readme badge commit 63b0d55ec87d5563eaf289f647ffe68a0cb2414d Author: Joe Date: Wed Jul 14 15:59:28 2021 +0100 updated citation in README, forgot to update covidregionaldata so produced the old one on knit commit edf7a1117aa6301ffe515960f4803f701f2f5ae8 Author: Joe Date: Wed Jul 14 13:25:08 2021 +0100 added link to discord chat in readme badge commit 2e0bb8b0a5bc10410632cd7f9a3ec212e89b69c0 Merge: 8fe326b2 9f1318e2 Author: Sam Abbott Date: Thu Jul 8 15:58:33 2021 +0100 Merge pull request #396 from epiforecasts/fix-paper-author-names fixed Richards last name commit 9f1318e2d9563784919912684dd49039d687004b Author: Joe Date: Thu Jul 8 10:06:13 2021 +0100 fixed Richards last name commit 8fe326b231cfa8e4bce444239d67def4656b14a4 Author: seabbs Date: Mon Jul 5 11:32:57 2021 +0000 update citation commit d51eabcc68cd448c3f3a4942de43eb9d223b7c6a Author: seabbs Date: Mon Jul 5 10:29:44 2021 +0000 CRAN check commit 7794fb0c041df4bf7a9f6fa29b95f63f0fbfd272 Author: seabbs Date: Mon Jul 5 09:11:33 2021 +0000 CRAN comments commit 08022ac1da27f873ce7104fd284a8cb72937c5c1 Author: seabbs Date: Mon Jul 5 09:11:10 2021 +0000 spelling commit 2aa08478f8d320d9e7a5e36560eac26a0a26abfa Merge: b7eeeaab 5b0d3475 Author: Sam Abbott Date: Sun Jul 4 17:40:32 2021 +0100 Merge pull request #395 from arfon/patch-1 commit 5b0d347562fdca8272a5b7bebd191d6918db4af7 Author: Arfon Smith Date: Sat Jul 3 22:02:29 2021 +0100 Fixing paper formatting. commit b7eeeaab553f898bd9cebb3e9a2e6aa80e5ddaec Author: Sam Abbott Date: Fri Jul 2 09:58:07 2021 +0100 Remove zenodo links and reference commit 4165c25b35aa6702032c8cd869b41e7f3e3211f9 Merge: dea9278c a2605334 Author: Sam Abbott Date: Thu Jul 1 16:41:12 2021 +0100 Merge pull request #394 from epiforecasts/RichardMN-patch-1 Spelling fix in Readme commit a2605334caeb6c65db3cb5217b6fe8e174f5d760 Author: Sam Abbott Date: Thu Jul 1 16:40:27 2021 +0100 Update README.md commit 992da9e5a7ee72b41f9d98e4680345131becdb71 Author: Richard Martin-Nielsen Date: Thu Jul 1 17:34:50 2021 +0300 Spelling fix in Readme commit dea9278cce97ba1593fabce2e9ad592940493e04 Author: seabbs Date: Thu Jul 1 14:11:35 2021 +0000 lithuania in news commit 4e1b9817c2955c4f2c29d0e2c0160b647e2389d2 Author: seabbs Date: Thu Jul 1 13:57:05 2021 +0000 release candidate commit 1e095cbe211b8130a63e3d1a7b7e9d214429a201 Author: seabbs Date: Thu Jul 1 13:44:42 2021 +0000 fix paper bib commit 1e4ebb5812cefed5cf56d6bab918d37338aa60cc Author: seabbs Date: Thu Jul 1 13:30:46 2021 +0000 CRAN comments commit 0e7e8372b8a03f2af6dd638855e8d2c754bde7ac Author: seabbs Date: Thu Jul 1 13:25:54 2021 +0000 tweak spelling and lint pass commit 44fddfc7c283d233842791fe678be27d45e1b228 Merge: a8a97a31 2b6fb387 Author: Sam Abbott Date: Thu Jul 1 13:59:56 2021 +0100 Merge pull request #392 from epiforecasts/final-joss-checks Final joss checks commit 2b6fb387f2c01cb4f9d343edb4874a72716a6ed9 Author: seabbs Date: Thu Jul 1 12:58:32 2021 +0000 update news commit 78cf45518f07ac775cbed8b06c602a2d0169ab80 Merge: 242679fd a8a97a31 Author: Sam Abbott Date: Thu Jul 1 13:36:36 2021 +0100 Merge branch 'master' into final-joss-checks commit a8a97a3142e3d0bddbc9db11af35b26dba3ad12b Merge: 4ad55834 bd5d30c4 Author: Sam Abbott Date: Thu Jul 1 13:31:32 2021 +0100 Merge pull request #388 from RichardMN:source-fields Add source text and url fields to classes commit bd5d30c4fecfcfa9949e7c79d9dd7cb79b69d5f9 Merge: 40d0b9d2 4ad55834 Author: seabbs Date: Thu Jul 1 12:29:38 2021 +0000 merge master, fix merge, et al commit 4ad5583425b3a725844c3e189f831d4cfba75651 Merge: 9df009db 6dc82c0c Author: Sam Abbott Date: Thu Jul 1 13:24:18 2021 +0100 Merge pull request #393 from epiforecasts:devcontainer Devcontainer commit 6dc82c0c60bb7f35a9043fe9b462f5b30de48013 Author: seabbs Date: Thu Jul 1 12:23:59 2021 +0000 update prec-commit commit 49deed2e7342a6e6ba9d5e212ce78f9af975ef25 Author: seabbs Date: Thu Jul 1 11:56:19 2021 +0000 docker build working commit ae46da44e0ff6d0055ad66e620ff7162beaddd2a Author: Sam Abbott Date: Thu Jul 1 11:05:19 2021 +0100 Update check-full.yaml commit c030f17e03cc0976f3638706a4977e031453b64c Author: seabbs Date: Thu Jul 1 09:58:13 2021 +0000 update naming and add docthis commit 4a07fd16f2a4bad9926cd427302eec1dc06acd77 Author: seabbs Date: Thu Jul 1 09:53:32 2021 +0000 switch to devcontainer commit 242679fd76a820667766e8f0b7d620f5b60dd26f Author: Joe Date: Thu Jul 1 08:24:21 2021 +0100 updated versioning and made title case commit 40d0b9d2fd1cb46134a3fd1fe5204ff7c994d11f Author: Richard Martin-Nielsen Date: Tue Jun 29 19:33:11 2021 +0300 Add source fields for country and global sources. commit c60fb7ec60760c53d03343a766d6350bf1f03b7b Author: Joe Date: Tue Jun 29 12:13:20 2021 +0100 updated version to description and news, also made recomended changes commit 84aa59efa14938f333a8bdcaa946023a5d8cac2a Author: Joe Date: Mon Jun 28 16:04:26 2021 +0100 updated news commit 611bfc7e1f375116256584555281e0d9af101de8 Author: Joe Date: Mon Jun 28 16:02:28 2021 +0100 updated citation, left doi blank as not sure what this will be... commit 2f2c015598330e6c51f1af721d84879c77e31749 Author: Joe Date: Mon Jun 28 15:48:20 2021 +0100 updated title to be same as the paper, author list looks the same as paper commit 9df009dbd19a69e758c71ed501173e4a5a39d94f Merge: 337f0b12 4f5ee094 Author: Sam Abbott Date: Mon Jun 28 14:30:28 2021 +0100 Merge pull request #390 from RichardMN/fix-render-available-datasets-389 Fixed glitch in rendering available datasets file - fixes #389 commit 337f0b1255e5d0d214fc9458ee222482ef95f9ce Merge: bf4b680c 07b7e393 Author: Sam Abbott Date: Mon Jun 28 14:27:57 2021 +0100 Merge pull request #383 from epiforecasts/hexisticker made draft hexsticker commit 07b7e39387bf0dab38e080d5bcba0ef7c92f5036 Merge: de74f9b9 bf4b680c Author: Joe Date: Mon Jun 28 13:26:22 2021 +0100 Merge branch 'master' into hexisticker commit de74f9b91a0851b323d6dbdeb047be9dfd97ae20 Author: Joe Date: Mon Jun 28 13:25:45 2021 +0100 made recomended changes, removed old logos and placed hexsticker in correct location commit 1de2205233b0d741360b7e637dc3997aac491bf0 Author: Richard Martin-Nielsen Date: Sat Jun 26 22:56:21 2021 +0300 Render documentation, generate available datasets file, lint commit bb115cae4134b2c0e4bc1cad80f5f2b78d569d85 Author: Richard Martin-Nielsen Date: Sat Jun 26 22:21:55 2021 +0300 Fixed handling of NULL in summary table, completed country data commit 4f5ee094477a7a20f86b300272e67e5bb2b037ac Author: Richard Martin-Nielsen Date: Sat Jun 26 21:53:43 2021 +0300 Fixed glitch in rendering available datasets file, added Switzerland test data commit df7993b98e9057b554fd5d022c41d1ade9abb490 Author: Richard Martin-Nielsen Date: Thu Jun 24 22:21:28 2021 +0300 Build documentation commit 00fd919d4537a790326357fd38808ff53e61ab1c Author: Richard Martin-Nielsen Date: Thu Jun 24 22:11:42 2021 +0300 Adjusted summary method, began adding source text and url fields commit 7cd6f0515b48462fe16577b69495d6ba24f1ebce Merge: 06a7eb4f ea6a48e1 Author: Richard Martin-Nielsen Date: Wed Jun 23 21:08:06 2021 +0300 Merge pull request #386 from RichardMN/hexisticker-regions Hexisticker - with region colouring using natural earth data and mapshaper for geometry manipulation commit ea6a48e1ae470e4fde4dbbf022bc2f65193c1648 Author: Richard Martin-Nielsen Date: Wed Jun 23 20:31:08 2021 +0300 Change outlines to be lines, reorder display, remove commented code commit ce0214dcd168d3ae6dd5ab7f6dc648bea4cd01d6 Author: Richard Martin-Nielsen Date: Tue Jun 22 21:27:05 2021 +0300 Outlines added to supported countries, palette adjusted, code reorganised slightly. commit 2815431f2446f38dc7c5e9f3ba2070e1472195da Merge: 5a113975 3b18401b Author: Richard Martin-Nielsen Date: Tue Jun 22 20:59:40 2021 +0300 Merge remote-tracking branch 'upstream/master' into hexisticker-regions commit 5a113975f7f13341efe5bed0e51283789dcf6999 Author: Richard Martin-Nielsen Date: Mon Jun 21 18:36:31 2021 +0300 Fixed separation of countries with level 1 and level 2 data commit 628a22fe9c21c125cc263594221afd4282a8028d Author: Richard Martin-Nielsen Date: Sun Jun 20 13:59:13 2021 +0300 Update README.md commit a6beb0a3ebcd9887c9076b2d64932adaa52a9fbe Author: Richard Martin-Nielsen Date: Sun Jun 20 13:57:58 2021 +0300 Add link to regional maps commit 88f7116c243346e947fd98dfa886fdf3cb105b57 Merge: 57d20c92 a137ddf4 Author: Richard Martin-Nielsen Date: Sun Jun 20 13:56:19 2021 +0300 Merge branch 'hexisticker-regions' of https://github.com/RichardMN/covidregionaldata into hexisticker-regions commit 57d20c92642d80e40172c7b4ae56b524f8baf1a1 Author: Richard Martin-Nielsen Date: Sun Jun 20 13:32:12 2021 +0300 Initial work to show regions for countries where we have regional data commit a137ddf41bd3c66a02f4f912dc7bc6a300b140fe Author: Richard Martin-Nielsen Date: Sun Jun 20 13:32:12 2021 +0300 Initial work to show regions for countries where we have regional data commit 06a7eb4fc4784004a5d9d527169108c08efd399a Author: Joe Date: Fri Jun 18 09:29:56 2021 +0100 altered borders to make regional data clearer commit fa13d32f86f97b830405697fadcf51f72b47ee89 Author: Joe Date: Thu Jun 17 13:31:19 2021 +0100 updated designs commit 2d91ab18e7cc760a0de904ea07a955a8c5a1c408 Merge: 96ee5ad7 f952cfcc Author: Sam Abbott Date: Wed Jun 16 17:20:51 2021 +0100 Merge branch 'master' into hexisticker commit 96ee5ad7665b08a228252ba41a151a546c0c02ff Merge: 63f77656 0564367e Author: Joe Date: Wed Jun 16 13:32:36 2021 +0100 Merge branch 'master' into hexisticker commit 63f7765647bd63795e45dfc23678898d53397791 Author: Joe Date: Wed Jun 16 13:28:45 2021 +0100 made draft hexsticker --- .github/workflows/pr-checklist.yaml | 2 +- DESCRIPTION | 4 - NAMESPACE | 19 ++-- NEWS.md | 3 +- R/Belgium.R | 11 ++- R/Brazil.R | 2 +- R/Canada.R | 2 +- R/Colombia.R | 1 - R/Cuba.R | 2 +- R/Estonia.R | 2 +- R/France.R | 1 - R/Germany.R | 3 +- R/India.R | 2 +- R/Italy.R | 2 +- R/JHU.R | 1 - R/Lithuania.R | 8 +- R/Mexico.R | 1 - R/Netherlands.R | 1 - R/SouthAfrica.R | 2 +- R/Switzerland.R | 111 ++++++++++++++---------- R/UK.R | 3 +- R/USA.R | 2 +- R/Vietnam.R | 8 +- R/get_available_datasets.R | 1 - R/get_linelist.R | 1 - R/processing.R | 17 ++-- R/shared-methods.R | 5 +- R/utils.R | 59 ++++++++----- README.Rmd | 2 +- _pkgdown.yml | 2 +- inst/WORDLIST | 1 + man/Switzerland.Rd | 47 ++++------ man/pipe.Rd | 20 ----- man/reexports.Rd | 4 +- tests/testthat/custom_tests/mock_data.R | 24 ++--- tests/testthat/test-csv_reader.R | 2 +- tests/testthat/test-processing.R | 16 ++-- 37 files changed, 181 insertions(+), 213 deletions(-) delete mode 100644 man/pipe.Rd diff --git a/.github/workflows/pr-checklist.yaml b/.github/workflows/pr-checklist.yaml index 3c292ca4..b3e982c9 100644 --- a/.github/workflows/pr-checklist.yaml +++ b/.github/workflows/pr-checklist.yaml @@ -14,4 +14,4 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: '👋 Thanks for opening this pull request! Can you please run through the following checklist before requesting review (ticking as complete or if not relevant). \n\n - [ ] Read our [contribution guidelines](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing) if you have not already done so. \n- [ ] If you have altered an existing class please run the tests locally (using `devtools::load_all(); devtools::test()`) first setting `options(testDownload=TRUE, testSource=class-name)` and report your findings. \n- [ ] If you have added a new data class please run the tests locally for that class (using `devtools::load_all(); devtools::test()`). \n- [ ] Check your code passes our CI checks and review any style and code coverage warnings. \n- [ ] Comment with details if unable to get our CI checks to pass or unable to remove all warnings. \n\nThank you again for the contribution. If making large scale changes consider using our `pre-commit` hooks (see the [contributing guide](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing)) to more easily comply with our guidelines.'}) + body: '👋 Thanks for opening this pull request! Can you please run through the following checklist before requesting review (ticking as complete or if not relevant). \n\n - [ ] Read our [contribution guidelines](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing) if you have not already done so. \n- [ ] If you have altered an existing class please run the tests locally (using `devtools::load_all(); devtools::test()`) first setting `options(testDownload=TRUE, testSource=class-name)` and report your findings. \n- [ ] If you have added a new data class please run the tests locally for that class (using `devtools::load_all(); devtools::test()`). \n- [ ] Check your code passes our CI checks and review any style and code coverage warnings. \n- [ ] Comment with details if unable to get our CI checks to pass or unable to remove all warnings. \n- [ ] Update the [news](https://github.com/epiforecasts/covidregionaldata/blob/master/NEWS.md) file with information on your changes (crediting yourself at the same time) \n\nThank you again for the contribution. If making large scale changes consider using our `pre-commit` hooks (see the [contributing guide](https://github.com/epiforecasts/covidregionaldata/wiki/Contributing)) to more easily comply with our guidelines.'}) diff --git a/DESCRIPTION b/DESCRIPTION index 20e44186..22712616 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -93,7 +93,6 @@ Imports: jsonlite, lifecycle, lubridate, - magrittr, memoise, purrr, R6, @@ -101,11 +100,8 @@ Imports: rlang, stringi, stringr, - tibble, tidyr (>= 1.0.0), - tidyselect, vroom, - withr, xml2 Suggests: ggplot2, diff --git a/NAMESPACE b/NAMESPACE index 5cdf4ccd..35d1f272 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -48,12 +48,14 @@ importFrom(countrycode,countrycode) importFrom(countrycode,countryname) importFrom(dplyr,"%>%") importFrom(dplyr,across) +importFrom(dplyr,all_of) importFrom(dplyr,arrange) importFrom(dplyr,as_tibble) importFrom(dplyr,bind_rows) importFrom(dplyr,count) importFrom(dplyr,distinct) importFrom(dplyr,do) +importFrom(dplyr,ends_with) importFrom(dplyr,everything) importFrom(dplyr,filter) importFrom(dplyr,full_join) @@ -78,6 +80,7 @@ importFrom(dplyr,summarise) importFrom(dplyr,tally) importFrom(dplyr,tibble) importFrom(dplyr,transmute) +importFrom(dplyr,tribble) importFrom(dplyr,ungroup) importFrom(dplyr,vars) importFrom(httr,GET) @@ -95,10 +98,10 @@ importFrom(lubridate,month) importFrom(lubridate,year) importFrom(lubridate,ymd) importFrom(lubridate,ymd_hms) -importFrom(magrittr,"%>%") importFrom(memoise,cache_filesystem) importFrom(memoise,memoise) importFrom(purrr,compact) +importFrom(purrr,keep) importFrom(purrr,map) importFrom(purrr,map_chr) importFrom(purrr,map_lgl) @@ -113,17 +116,12 @@ importFrom(rlang,"!!") importFrom(rlang,":=") importFrom(rlang,.data) importFrom(rlang,syms) -importFrom(stringi,stri_replace_all) -importFrom(stringi,stri_trans_general) -importFrom(stringi,stri_trim_both) +importFrom(stringr,str_conv) importFrom(stringr,str_detect) importFrom(stringr,str_replace_all) importFrom(stringr,str_to_sentence) importFrom(stringr,str_to_title) -importFrom(tibble,add_column) -importFrom(tibble,as_tibble) -importFrom(tibble,tibble) -importFrom(tibble,tribble) +importFrom(stringr,str_trim) importFrom(tidyr,complete) importFrom(tidyr,drop_na) importFrom(tidyr,fill) @@ -133,13 +131,8 @@ importFrom(tidyr,pivot_longer) importFrom(tidyr,pivot_wider) importFrom(tidyr,replace_na) importFrom(tidyr,separate) -importFrom(tidyselect,all_of) -importFrom(tidyselect,ends_with) -importFrom(tidyselect,starts_with) -importFrom(tidyselect,vars_select_helpers) importFrom(utils,download.file) importFrom(utils,untar) importFrom(vroom,vroom) -importFrom(withr,with_envvar) importFrom(xml2,xml_find_first) importFrom(xml2,xml_text) diff --git a/NEWS.md b/NEWS.md index 61e9897b..4a270315 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,8 +9,9 @@ This release is currently under development ## Other changes +* Change the data source for Switzerland to draw data from the Swiss Federal Office of Public Health (FOPH) * Updated the package logo to include the newly supported data sets. - +* Reduced the number of package dependencies (@bisaloo and @RichardMN) ## Bug fixes - Fixed a bug in the data sourced from Germany so that instead of treating it as a line list of individuals it is treated as a relatively finely resolved count data which needs to be summed up (by @sbfnk). diff --git a/R/Belgium.R b/R/Belgium.R index 24b9775d..8207eb74 100644 --- a/R/Belgium.R +++ b/R/Belgium.R @@ -57,13 +57,13 @@ Belgium <- R6::R6Class("Belgium", source_url = "https://epistat.wiv-isp.be/covid/", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble tribble + #' @importFrom dplyr tibble tribble set_region_codes = function() { - self$codes_lookup$`1` <- tibble::tibble( + self$codes_lookup$`1` <- tibble( level_1_region_code = c("BE-BRU", "BE-VLG", "BE-WAL"), level_1_region = c("Brussels", "Flanders", "Wallonia") ) - self$codes_lookup$`2` <- tibble::tribble( + self$codes_lookup$`2` <- tribble( ~level_2_region_code, ~level_2_region, ~level_1_region_code, "BE-VAN", "Antwerpen", "BE-VLG", "BE-WBR", "BrabantWallon", "BE-WAL", @@ -82,8 +82,7 @@ Belgium <- R6::R6Class("Belgium", #' @description Downloads data from source and (for Belgium) #' applies an initial data patch. - #' @importFrom dplyr select mutate filter bind_rows - #' @importFrom tibble tribble + #' @importFrom dplyr select mutate filter bind_rows tribble download = function() { # do the actual downloading using the parent download method super$download() @@ -92,7 +91,7 @@ Belgium <- R6::R6Class("Belgium", # For now, we filter out the broken lines and replace them # with the following data shim - fixed_lines <- tibble::tribble( + fixed_lines <- tribble( ~DATE, ~PROVINCE, ~REGION, ~AGEGROUP, ~SEX, ~CASES, "2020-04-22", "Limburg", "Flanders", "50-59", "F", 10, "2021-02-17", "VlaamsBrabant", "Flanders", "10-19", "M", 12 diff --git a/R/Brazil.R b/R/Brazil.R index 6be4ef3a..ba47b462 100644 --- a/R/Brazil.R +++ b/R/Brazil.R @@ -47,7 +47,7 @@ Brazil <- R6::R6Class("Brazil", source_url = "https://github.com/wcota/covid19br/blob/master/README.en.md", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tribble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup <- tibble( state_name = c( diff --git a/R/Canada.R b/R/Canada.R index c6e3bb4c..b0036a39 100644 --- a/R/Canada.R +++ b/R/Canada.R @@ -44,7 +44,7 @@ Canada <- R6::R6Class("Canada", source_url = "https://open.canada.ca/data/en/dataset/261c32ab-4cfd-4f81-9dea-7b64065690dc", # nolint #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { canada_codes <- tibble( code = c( diff --git a/R/Colombia.R b/R/Colombia.R index c1a3154c..b920f1d9 100644 --- a/R/Colombia.R +++ b/R/Colombia.R @@ -41,7 +41,6 @@ Colombia <- R6::R6Class("Colombia", source_url = "https://github.com/danielcs88/colombia_covid-19/", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble #' @importFrom dplyr mutate set_region_codes = function() { self$codes_lookup$`1` <- covidregionaldata::colombia_codes diff --git a/R/Cuba.R b/R/Cuba.R index b286652a..f6c13c4c 100644 --- a/R/Cuba.R +++ b/R/Cuba.R @@ -42,7 +42,7 @@ Cuba <- R6::R6Class("Cuba", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c( diff --git a/R/Estonia.R b/R/Estonia.R index 564601b8..0cf17a55 100644 --- a/R/Estonia.R +++ b/R/Estonia.R @@ -43,7 +43,7 @@ Estonia <- R6::R6Class("Estonia", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c("EE-37", diff --git a/R/France.R b/R/France.R index 643f6536..5c0fa701 100644 --- a/R/France.R +++ b/R/France.R @@ -50,7 +50,6 @@ France <- R6::R6Class("France", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble #' @importFrom dplyr select set_region_codes = function() { self$codes_lookup$`1` <- france_codes %>% diff --git a/R/Germany.R b/R/Germany.R index 3108357a..67d047c5 100644 --- a/R/Germany.R +++ b/R/Germany.R @@ -44,8 +44,7 @@ Germany <- R6::R6Class("Germany", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble - #' @importFrom dplyr mutate + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c( diff --git a/R/India.R b/R/India.R index 56903124..a1040db3 100644 --- a/R/India.R +++ b/R/India.R @@ -37,7 +37,7 @@ India <- R6::R6Class("India", source_url = "https://www.covid19india.org", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c( diff --git a/R/Italy.R b/R/Italy.R index 30a5b731..18fd963e 100644 --- a/R/Italy.R +++ b/R/Italy.R @@ -42,7 +42,7 @@ Italy <- R6::R6Class("Italy", source_url = "https://github.com/pcm-dpc/COVID-19/blob/master/README_EN.md", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c( diff --git a/R/JHU.R b/R/JHU.R index 4d303593..23e2925c 100644 --- a/R/JHU.R +++ b/R/JHU.R @@ -84,7 +84,6 @@ JHU <- R6::R6Class("JHU", # rename to country name source_url = "https://github.com/CSSEGISandData/COVID-19/", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble set_region_codes = function() { self$codes_lookup$`1` <- JHU_codes }, diff --git a/R/Lithuania.R b/R/Lithuania.R index a1b891fe..db931df0 100644 --- a/R/Lithuania.R +++ b/R/Lithuania.R @@ -184,8 +184,7 @@ Lithuania <- R6::R6Class("Lithuania", #' @description Common data cleaning for both levels #' # nolint start - #' @importFrom dplyr mutate group_by summarise if_else filter select bind_rows rename left_join everything across lead - #' @importFrom tidyselect all_of + #' @importFrom dplyr mutate group_by summarise if_else filter select bind_rows rename left_join everything across lead all_of #' @importFrom lubridate as_date # nolint end clean_common = function() { @@ -244,7 +243,7 @@ Lithuania <- R6::R6Class("Lithuania", # or qualitative) sum_cols <- names(select( self$data$raw$main, - "population":tidyselect::last_col() + "population":dplyr::last_col() )) sum_cols <- sum_cols[!grepl("prc|map_colors", sum_cols)] @@ -345,7 +344,6 @@ Lithuania <- R6::R6Class("Lithuania", #' provided by the source at the level 2 (municipality) regional level. #' #' @importFrom dplyr group_by summarise ungroup full_join across if_else - #' @importFrom tidyselect vars_select_helpers clean_level_1 = function() { self$data$clean <- self$data$clean %>% group_by( @@ -354,7 +352,7 @@ Lithuania <- R6::R6Class("Lithuania", ) %>% summarise( across( - tidyselect::vars_select_helpers$where(is.numeric), + where(is.numeric), sum ) ) %>% diff --git a/R/Mexico.R b/R/Mexico.R index 4c09e291..a94ddfb6 100644 --- a/R/Mexico.R +++ b/R/Mexico.R @@ -54,7 +54,6 @@ Mexico <- R6::R6Class("Mexico", source_url = "https://datos.covid-19.conacyt.mx", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble #' @importFrom dplyr select set_region_codes = function() { self$codes_lookup$`1` <- covidregionaldata::mexico_codes %>% diff --git a/R/Netherlands.R b/R/Netherlands.R index 94a4fc55..a4afdf05 100644 --- a/R/Netherlands.R +++ b/R/Netherlands.R @@ -46,7 +46,6 @@ Netherlands <- R6::R6Class("Netherlands", source_url = "https://data.rivm.nl/covid-19/", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble set_region_codes = function() { }, diff --git a/R/SouthAfrica.R b/R/SouthAfrica.R index 152ca767..47463cf7 100644 --- a/R/SouthAfrica.R +++ b/R/SouthAfrica.R @@ -41,7 +41,7 @@ SouthAfrica <- R6::R6Class("SouthAfrica", source_url = "https://github.com/dsfsi/covid19za", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c( diff --git a/R/Switzerland.R b/R/Switzerland.R index bc296b90..020b7f5b 100644 --- a/R/Switzerland.R +++ b/R/Switzerland.R @@ -2,31 +2,6 @@ #' @description Information for downloading, cleaning #' and processing COVID-19 region data for Switzerland #' -#' @section Liechtenstein: -#' Liechtenstein is not a canton of Switzerland, but is presented in the -#' source data as a peer of Swiss cantons and assigned the two letter code -#' `FL`. `covidregionaldata` modifies this and presents the region code -#' for Liechtenstein as `FL-FL`, consistent with the Swiss ISO 3166-2 codes -#' which are of the form `CH-BE`, `CH-ZH`, `CH-VD`, ... -#' -#' If you do not wish to work with Liechtenstein -#' data, filter out on this code. Note that this is labelled as a ISO 3166-2 -#' code but Liechtenstein's real ISO 3166-2 codes refer to sub-national -#' regions. -#' -#' @section Additional data: -#' -#' In addition to the standard `covidregionaldata` columns provided, -#' the OpenDataZH source data provides other figures for ICU occupancy, -#' number of patients on ventilators, and the how many individuals are -#' isolated or quarantined. These columns are passed through unchanged. - -#' Further detail on them can be found at -# nolint start -#' \url{https://github.com/openZH/covid_19/#swiss-cantons-and-principality-of-liechtenstein-unified-dataset} -#' @source \url{https://github.com/openZH/covid_19/} -# nolint end -#' #' @export #' @concept dataset #' @family subnational @@ -48,12 +23,12 @@ Switzerland <- R6::R6Class("Switzerland", supported_region_names = list("1" = "canton"), #' @field supported_region_codes A list of region codes in order of level. supported_region_codes = list("1" = "iso_3166_2"), - #' @field common_data_urls List of named links to raw data. - # nolint start + #' @field common_data_urls List of named links to raw data. This url links + #' to a JSON file which provides the addresses for the most recently-updated + #' CSV files, which are then downloaded. common_data_urls = list( - "main" = "https://github.com/openZH/covid_19/raw/master/COVID19_Fallzahlen_CH_total_v2.csv" + "main" = "https://www.covid19.admin.ch/api/data/context" ), - # nolint end #' @field source_data_cols existing columns within the raw data source_data_cols = c( "hosp_new", @@ -63,13 +38,13 @@ Switzerland <- R6::R6Class("Switzerland", "tested_total" ), #' @field source_text Plain text description of the source of the data - source_text = "Open Data, Canton of Zurich", + source_text = "Swiss Federal Office of Public Health FOPH", #' @field source_url Website address for explanation/introduction of the #' data - source_url = "https://github.com/openZH/covid_19/", + source_url = "https://www.covid19.admin.ch/en/overview", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup$`1` <- tibble( code = c( @@ -94,19 +69,71 @@ Switzerland <- R6::R6Class("Switzerland", ) }, + #' @description Download function to get raw data. Downloads + #' the updated list of CSV files using `download_JSON`, filters + #' that to identify the required CSV files, then uses the parent + #' method `download` to download the CSV files. + #' @importFrom purrr keep + download = function() { + message_verbose( + self$verbose, + paste0("Downloading updated URLs from ", self$common_data_urls$main)) + + super$download_JSON() + + self$data_urls <- + self$data$raw$main$data$sources$individual$csv$daily %>% + keep(names(.) %in% c("cases", "test", "death", "hosp")) + + super$download() + }, + #' @description Switzerland specific state level data cleaning - #' @importFrom dplyr select filter mutate left_join rename + #' @importFrom dplyr select filter mutate left_join rename full_join #' @importFrom lubridate as_date ymd #' @importFrom rlang .data #' clean_common = function() { - self$data$clean <- self$data$raw[["main"]] %>% - select(-time, -source) %>% + cases <- self$data$raw$cases %>% + filter(geoRegion != "CH", geoRegion != "CHFL", datum_unit == "day") %>% + select(geoRegion, datum, entries, sumTotal) %>% + rename(level_1_region_code = geoRegion, + date = datum, + cases_new = entries, + cases_total = sumTotal) + hosp <- self$data$raw$hosp %>% + filter(geoRegion != "CH", geoRegion != "CHFL", datum_unit == "day") %>% + select(geoRegion, datum, entries, sumTotal) %>% + rename(level_1_region_code = geoRegion, + date = datum, + hosp_new = entries, + hosp_total = sumTotal) + deaths <- self$data$raw$death %>% + filter(geoRegion != "CH", geoRegion != "CHFL", datum_unit == "day") %>% + select(geoRegion, datum, entries, sumTotal) %>% + rename(level_1_region_code = geoRegion, + date = datum, + deaths_new = entries, + deaths_total = sumTotal) + tests <- self$data$raw$test %>% + filter(geoRegion != "CH", geoRegion != "CHFL", datum_unit == "day") %>% + # note that the data has entries_pos and entries_neg and we're + # currently not using it. + select(geoRegion, datum, entries, sumTotal) %>% + rename(level_1_region_code = geoRegion, + date = datum, + tested_new = entries, + tested_total = sumTotal) + + self$data$clean <- + full_join(cases, deaths, by = c("date", "level_1_region_code")) %>% + full_join(hosp, by = c("date", "level_1_region_code")) %>% + full_join(tests, by = c("date", "level_1_region_code")) %>% mutate( level_1_region_code = if_else( - .data$abbreviation_canton_and_fl == "FL", + .data$level_1_region_code == "FL", "FL-FL", - paste0("CH-", .data$abbreviation_canton_and_fl) + paste0("CH-", .data$level_1_region_code) ), date = as_date(ymd(.data$date)) ) %>% @@ -114,15 +141,7 @@ Switzerland <- R6::R6Class("Switzerland", self$codes_lookup$`1`, by = c("level_1_region_code" = "code") ) %>% - select(-abbreviation_canton_and_fl) %>% - rename( - level_1_region = .data$region, - cases_total = .data$ncumul_conf, - deaths_total = .data$ncumul_deceased, - hosp_new = .data$new_hosp, - recovered_total = .data$ncumul_released, - tested_total = .data$ncumul_tested - ) + rename(level_1_region = region) } ) ) diff --git a/R/UK.R b/R/UK.R index 05d1d55a..547f4da2 100644 --- a/R/UK.R +++ b/R/UK.R @@ -450,8 +450,7 @@ UK <- R6::R6Class("UK", #' Section 2, "2. Estimated new hospital cases" #' @importFrom lubridate year month #' @importFrom readxl read_excel cell_limits - #' @importFrom tibble as_tibble - #' @importFrom dplyr mutate select %>% group_by summarise left_join + #' @importFrom dplyr mutate select %>% group_by summarise left_join as_tibble #' @importFrom tidyr pivot_longer #' @param clean_data Cleaned UK covid-19 data #' @param nhs_data NHS region data diff --git a/R/USA.R b/R/USA.R index a00b9ece..4ae7a0cf 100644 --- a/R/USA.R +++ b/R/USA.R @@ -49,7 +49,7 @@ USA <- R6::R6Class("USA", source_url = "https://github.com/nytimes/covid-19-data", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tribble + #' @importFrom dplyr tibble set_region_codes = function() { self$codes_lookup <- usa_codes <- tibble( level_1_region_code = c( diff --git a/R/Vietnam.R b/R/Vietnam.R index 12758396..44062df8 100644 --- a/R/Vietnam.R +++ b/R/Vietnam.R @@ -47,7 +47,6 @@ Vietnam <- R6::R6Class("Vietnam", source_url = "https://covid19.ncsc.gov.vn", #' @description Set up a table of region codes for clean data - #' @importFrom tibble tibble set_region_codes = function() { self$codes_lookup$`1` <- covidregionaldata::vietnam_codes }, @@ -65,8 +64,7 @@ Vietnam <- R6::R6Class("Vietnam", #' @importFrom dplyr filter select mutate rename tibble as_tibble full_join #' @importFrom tidyr replace_na drop_na separate #' @importFrom purrr map - #' @importFrom stringi stri_trans_general stri_trim_both stri_replace_all - #' @importFrom stringr str_to_title str_replace_all + #' @importFrom stringr str_conv str_trim str_to_title str_replace_all #' @importFrom lubridate dmy clean_common = function() { # The first three elements of self$data$raw are the data @@ -121,8 +119,8 @@ Vietnam <- R6::R6Class("Vietnam", # #tidyr::drop_na(date, region_name) %>% mutate( - level_1_region = stri_trans_general(level_1_region, "latin-ascii"), - level_1_region = stri_trim_both(level_1_region), + level_1_region = str_conv(level_1_region, "ASCII"), + level_1_region = str_trim(level_1_region, side = "both"), level_1_region = str_replace_all(level_1_region, "\\(.*\\)|-| ", ""), level_1_region = str_to_title(level_1_region), diff --git a/R/get_available_datasets.R b/R/get_available_datasets.R index 90f828e1..171fded0 100644 --- a/R/get_available_datasets.R +++ b/R/get_available_datasets.R @@ -18,7 +18,6 @@ #' @family interface #' @importFrom rlang .data #' @importFrom dplyr select bind_rows filter -#' @importFrom tibble as_tibble #' @export #' @examples #' # see all available datasets diff --git a/R/get_linelist.R b/R/get_linelist.R index b0d6a179..6b5f48ca 100644 --- a/R/get_linelist.R +++ b/R/get_linelist.R @@ -24,7 +24,6 @@ #' @importFrom lifecycle deprecate_warn #' @importFrom dplyr if_else select mutate filter #' @importFrom lubridate dmy -#' @importFrom tibble as_tibble #' @importFrom utils download.file untar #' @examples #' \dontrun{ diff --git a/R/processing.R b/R/processing.R index 66887605..23a0b2ad 100644 --- a/R/processing.R +++ b/R/processing.R @@ -7,7 +7,7 @@ #' @return A tibble with relevant NA columns added #' @family compulsory_processing #' @concept compulsory_processing -#' @importFrom tibble tibble add_column +#' @importFrom dplyr mutate #' @importFrom rlang !!! add_extra_na_cols <- function(data) { expected_col_names <- c( @@ -17,7 +17,7 @@ add_extra_na_cols <- function(data) { new_cols <- rep(list(NA_real_), length(expected_col_names)) names(new_cols) <- expected_col_names - data <- add_column( + data <- mutate( data, !!!new_cols[!(names(new_cols) %in% names(data))] ) @@ -50,9 +50,8 @@ set_negative_values_to_zero <- function(data) { #' @return A tibble with rows of NAs added. #' @family compulsory_processing #' @concept compulsory_processing -#' @importFrom tibble tibble #' @importFrom tidyr complete full_seq nesting -#' @importFrom tidyselect starts_with +#' @importFrom dplyr starts_with #' @importFrom rlang !!! syms fill_empty_dates_with_na <- function(data) { regions <- select(data, starts_with("level_")) %>% @@ -76,7 +75,7 @@ fill_empty_dates_with_na <- function(data) { #' @family compulsory_processing #' @concept compulsory_processing #' @importFrom tidyr fill -#' @importFrom tidyselect all_of +#' @importFrom dplyr all_of complete_cumulative_columns <- function(data) { cumulative_col_names <- c( "deaths_total", "cases_total", "recovered_total", @@ -99,11 +98,9 @@ complete_cumulative_columns <- function(data) { #' @return A data frame with extra columns if required #' @family compulsory_processing #' @concept compulsory_processing -#' @importFrom dplyr mutate group_by_at arrange vars starts_with lag +#' @importFrom dplyr mutate group_by_at arrange vars starts_with lag ends_with #' @importFrom purrr walk2 #' @importFrom tidyr replace_na -#' @importFrom tidyselect ends_with -#' @importFrom tibble tibble #' @importFrom rlang !! := calculate_columns_from_existing_data <- function(data) { possible_counts <- c("cases", "deaths", "hosp", "recovered", "tested") @@ -150,7 +147,6 @@ calculate_columns_from_existing_data <- function(data) { #' @param data A data table #' @return A data table, totalled up #' @importFrom dplyr left_join group_by summarise select arrange -#' @importFrom tibble tibble #' @family optional_processing #' @concept optional_processing totalise_data <- function(data) { @@ -223,10 +219,9 @@ run_optional_processing_fns <- function(data, process_fns) { #' processing steps #' @concept utility #' @family processing -#' @importFrom dplyr do group_by_at across ungroup select everything arrange +#' @importFrom dplyr do group_by_at across ungroup select everything arrange all_of #' @importFrom dplyr rename #' @importFrom tidyr drop_na -#' @importFrom tidyselect all_of #' @importFrom rlang !!! process_internal <- function(clean_data, level, group_vars, totals = FALSE, localise = TRUE, diff --git a/R/shared-methods.R b/R/shared-methods.R index 3b413380..62a88ba8 100644 --- a/R/shared-methods.R +++ b/R/shared-methods.R @@ -351,8 +351,7 @@ DataClass <- R6::R6Class( #' field. #' @param level A character string indicating the level to filter at. #' Defaults to using the `filter_level` field if not specified - #' @importFrom tidyselect all_of - #' @importFrom dplyr select filter pull + #' @importFrom dplyr select filter pull all_of available_regions = function(level) { if (is.null(self$data$clean)) { stop("Data must first be cleaned using the clean method") @@ -505,7 +504,7 @@ DataClass <- R6::R6Class( #' @description Create a table of summary information for the data set #' being processed. - #' @importFrom tibble tibble + #' @importFrom dplyr tibble #' @return Returns a single row summary tibble containing the origin of the #' data source, class, level 1 and 2 region names, the type of data, #' the urls of the raw data and the columns present in the raw data. diff --git a/R/utils.R b/R/utils.R index da992a3d..80083d40 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,19 +1,6 @@ -#' Pipe operator -#' -#' @description See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. -#' @name %>% -#' @rdname pipe -#' @keywords internal +#' @importFrom dplyr %>% #' @export -#' @importFrom magrittr %>% -#' @usage lhs \%>\% rhs -#' @param lhs A value or the magrittr placeholder. -#' @param rhs A function call using the magrittr semantics. -#' @return The result of calling `rhs(lhs)`. -NULL - -#' @importFrom rlang .data -rlang::`.data` +dplyr::`%>%` #' Custom CSV reading function #' @@ -26,8 +13,7 @@ rlang::`.data` #' @return A data table #' @importFrom memoise memoise cache_filesystem #' @importFrom vroom vroom -#' @importFrom tibble tibble -#' @importFrom withr with_envvar +#' @importFrom dplyr tibble #' @concept utility csv_reader <- function(file, verbose = FALSE, guess_max = 1000, ...) { read_csv_fun <- vroom @@ -39,14 +25,35 @@ csv_reader <- function(file, verbose = FALSE, guess_max = 1000, ...) { } if (verbose) { message("Downloading data from ", file) - data <- read_csv_fun(file, ..., guess_max = guess_max) + data <- read_csv_fun(file, progress = TRUE, ..., guess_max = guess_max) } else { - with_envvar( - new = c("VROOM_SHOW_PROGRESS" = "false"), - data <- suppressWarnings( - suppressMessages( - read_csv_fun(file, ..., guess_max = guess_max) - ) + data <- suppressWarnings( + suppressMessages( + read_csv_fun(file, progress = FALSE, ..., guess_max = guess_max) + ) + ) + } + return(tibble(data)) +} + +#' Custom JSON reading function +#' +#' @description Checks for use of memoise and then uses vroom::vroom. +#' @param file A URL or filepath to a JSON +#' @param ... extra parameters to be passed to jsonlite::fromJSON +#' @inheritParams message_verbose +#' @return A data table +#' @importFrom dplyr tibble +#' @importFrom jsonlite fromJSON +#' @concept utility +json_reader <- function(file, verbose = FALSE, ...) { + if (verbose) { + message("Downloading data from ", file) + data <- fromJSON(file, ...) + } else { + data <- suppressWarnings( + suppressMessages( + fromJSON(file, ...) ) ) } @@ -320,3 +327,7 @@ make_new_data_source <- function(source, type = "subnational", ) make_github_workflow(source) } + +# Hack to work around the fact that `where()` is not exported +# (https://github.com/r-lib/tidyselect/issues/201) +utils::globalVariables("where") diff --git a/README.Rmd b/README.Rmd index feac3205..a42bda15 100644 --- a/README.Rmd +++ b/README.Rmd @@ -15,7 +15,7 @@ knitr::opts_chunk$set( [![R-CMD-check](https://github.com/epiforecasts/covidregionaldata/workflows/R-CMD-check/badge.svg)](https://github.com/epiforecasts/covidregionaldata/actions) [![Codecov test coverage](https://codecov.io/gh/epiforecasts/covidregionaldata/branch/master/graph/badge.svg)](https://codecov.io/gh/epiforecasts/covidregionaldata?branch=master) [![Data status](https://img.shields.io/badge/Data-status-lightblue.svg?style=flat)](https://epiforecasts.io/covidregionaldata/articles/supported-countries.html) [![metacran downloads](http://cranlogs.r-pkg.org/badges/grand-total/covidregionaldata?color=ff69b4)](https://cran.r-project.org/package=covidregionaldata) -[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/epiforecasts/covidregionaldata/blob/master/LICENSE.md/) [![GitHub contributors](https://img.shields.io/github/contributors/epiforecasts/covidregionaldata)](https://github.com/epiforecasts/covidregionaldata/graphs/contributors) [![Discord](https://img.shields.io/discord/864828485981306890?logo=Discord)](https://discord.gg/9YPDDADVt3) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-yellow.svg)](https://makeapullrequest.com/) [![GitHub commits](https://img.shields.io/github/commits-since/epiforecasts/covidregionaldata/0.9.2.svg?color=orange)](https://github.com/epiforecasts/covidregionaldata/commit/master/) +[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/epiforecasts/covidregionaldata/blob/master/LICENSE.md/) [![GitHub contributors](https://img.shields.io/github/contributors/epiforecasts/covidregionaldata)](https://github.com/epiforecasts/covidregionaldata/graphs/contributors) [![Discord](https://img.shields.io/discord/864828485981306890?logo=Discord)](https://discord.gg/9YPDDADVt3) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-yellow.svg)](https://makeapullrequest.com/) [![GitHub commits](https://img.shields.io/github/commits-since/epiforecasts/covidregionaldata/0.9.2.svg?color=orange)](https://github.com/epiforecasts/covidregionaldata/commit/master/) [![JOSS](https://joss.theoj.org/papers/10.21105/joss.03290/status.svg)](https://doi.org/10.21105/joss.03290) [![Zenodo](https://zenodo.org/badge/271601189.svg)](https://zenodo.org/badge/latestdoi/271601189) diff --git a/_pkgdown.yml b/_pkgdown.yml index 27a7fa1e..da51ab70 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: epiforecasts.io/covidregionaldata/ +url: https://epiforecasts.io/covidregionaldata/ template: bootstrap: 5 params: diff --git a/inst/WORDLIST b/inst/WORDLIST index 5a6b0080..abf97ef6 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -46,6 +46,7 @@ filepath flavio Flavio fns +FOPH fromJSON gb geocode diff --git a/man/Switzerland.Rd b/man/Switzerland.Rd index c5ab1201..3f942b05 100644 --- a/man/Switzerland.Rd +++ b/man/Switzerland.Rd @@ -3,38 +3,10 @@ \name{Switzerland} \alias{Switzerland} \title{Switzerland Class for downloading, cleaning and processing notification data} -\source{ -\url{https://github.com/openZH/covid_19/} -} \description{ Information for downloading, cleaning and processing COVID-19 region data for Switzerland } -\section{Liechtenstein}{ - -Liechtenstein is not a canton of Switzerland, but is presented in the -source data as a peer of Swiss cantons and assigned the two letter code -\code{FL}. \code{covidregionaldata} modifies this and presents the region code -for Liechtenstein as \code{FL-FL}, consistent with the Swiss ISO 3166-2 codes -which are of the form \code{CH-BE}, \code{CH-ZH}, \code{CH-VD}, ... - -If you do not wish to work with Liechtenstein -data, filter out on this code. Note that this is labelled as a ISO 3166-2 -code but Liechtenstein's real ISO 3166-2 codes refer to sub-national -regions. -} - -\section{Additional data}{ - - -In addition to the standard \code{covidregionaldata} columns provided, -the OpenDataZH source data provides other figures for ICU occupancy, -number of patients on ventilators, and the how many individuals are -isolated or quarantined. These columns are passed through unchanged. -Further detail on them can be found at -\url{https://github.com/openZH/covid_19/#swiss-cantons-and-principality-of-liechtenstein-unified-dataset} -} - \examples{ \dontrun{ region <- Switzerland$new(verbose = TRUE, steps = TRUE, get = TRUE) @@ -80,7 +52,9 @@ Subnational data sources \item{\code{supported_region_codes}}{A list of region codes in order of level.} -\item{\code{common_data_urls}}{List of named links to raw data.} +\item{\code{common_data_urls}}{List of named links to raw data. This url links +to a JSON file which provides the addresses for the most recently-updated +CSV files, which are then downloaded.} \item{\code{source_data_cols}}{existing columns within the raw data} @@ -95,6 +69,7 @@ data} \subsection{Public methods}{ \itemize{ \item \href{#method-set_region_codes}{\code{Switzerland$set_region_codes()}} +\item \href{#method-download}{\code{Switzerland$download()}} \item \href{#method-clean_common}{\code{Switzerland$clean_common()}} \item \href{#method-clone}{\code{Switzerland$clone()}} } @@ -104,7 +79,6 @@ data} \itemize{ \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-available_regions}{\code{covidregionaldata::DataClass$available_regions()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-clean}{\code{covidregionaldata::DataClass$clean()}}\out{} -\item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download}{\code{covidregionaldata::DataClass$download()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-download_JSON}{\code{covidregionaldata::DataClass$download_JSON()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-filter}{\code{covidregionaldata::DataClass$filter()}}\out{} \item \out{}\href{../../covidregionaldata/html/DataClass.html#method-get}{\code{covidregionaldata::DataClass$get()}}\out{} @@ -125,6 +99,19 @@ Set up a table of region codes for clean data \if{html}{\out{
}}\preformatted{Switzerland$set_region_codes()}\if{html}{\out{
}} } +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-download}{}}} +\subsection{Method \code{download()}}{ +Download function to get raw data. Downloads +the updated list of CSV files using \code{download_JSON}, filters +that to identify the required CSV files, then uses the parent +method \code{download} to download the CSV files. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{Switzerland$download()}\if{html}{\out{
}} +} + } \if{html}{\out{
}} \if{html}{\out{}} diff --git a/man/pipe.Rd b/man/pipe.Rd deleted file mode 100644 index 5fa90fe3..00000000 --- a/man/pipe.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{\%>\%} -\alias{\%>\%} -\title{Pipe operator} -\usage{ -lhs \%>\% rhs -} -\arguments{ -\item{lhs}{A value or the magrittr placeholder.} - -\item{rhs}{A function call using the magrittr semantics.} -} -\value{ -The result of calling \code{rhs(lhs)}. -} -\description{ -See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details. -} -\keyword{internal} diff --git a/man/reexports.Rd b/man/reexports.Rd index 3b0d9eb6..bd44fd4a 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -3,7 +3,7 @@ \docType{import} \name{reexports} \alias{reexports} -\alias{.data} +\alias{\%>\%} \title{Objects exported from other packages} \keyword{internal} \description{ @@ -11,6 +11,6 @@ These objects are imported from other packages. Follow the links below to see their documentation. \describe{ - \item{rlang}{\code{\link[rlang:tidyeval-data]{.data}}} + \item{dplyr}{\code{\link[dplyr:reexports]{\%>\%}}} }} diff --git a/tests/testthat/custom_tests/mock_data.R b/tests/testthat/custom_tests/mock_data.R index 7262ead6..4b09b694 100644 --- a/tests/testthat/custom_tests/mock_data.R +++ b/tests/testthat/custom_tests/mock_data.R @@ -15,7 +15,7 @@ get_expected_data_for_get_regional_data_tests_only_level_1_regions <- function() dates <- c("2020-01-31", "2020-02-01", "2020-02-02", "2020-02-03", "2020-02-04", "2020-02-05") provinces <- c("Northland", "Eastland", "Southland", "Westland", "Virginia") ## Fake region codes - region_codes <- tibble::tibble(iso_3166_2 = c("NO", "EA", "SO", "WE", "VA"), region = provinces) + region_codes <- dplyr::tibble(iso_3166_2 = c("NO", "EA", "SO", "WE", "VA"), region = provinces) expected_data_for_provinces <- list() for (i in 1:length(provinces)) { @@ -87,7 +87,7 @@ get_expected_data_for_get_regional_data_tests_only_level_1_regions <- function() ) %>% dplyr::arrange(date, province) - return(tibble::tibble(expected_data)) + return(dplyr::tibble(expected_data)) } get_input_data_for_get_regional_data_tests_only_level_1_regions <- function() { @@ -109,7 +109,7 @@ get_expected_totals_data_for_get_regional_data_tests_only_level_1_regions <- fun colnames(totals_data) <- c("province", "iso_3166_2", "cases_total", "deaths_total", "recovered_total", "hosp_total", "tested_total") totals_data <- totals_data %>% dplyr::arrange(-cases_total) - return(tibble::tibble(totals_data)) + return(dplyr::tibble(totals_data)) } @@ -117,7 +117,7 @@ get_expected_totals_data_for_get_regional_data_tests_only_level_1_regions <- fun get_input_data_for_get_regional_data_tests_with_level_2_regions <- function() { data <- get_input_data_for_get_regional_data_tests_only_level_1_regions() colnames(data)[2] <- "level_2_region" - regions_table <- tibble::tibble( + regions_table <- dplyr::tibble( level_2_region = c("Northland", "Eastland", "Southland", "Westland", "Virginia"), level_1_region = c("Oneland", "Oneland", "Twoland", "Twoland", "USA") ) @@ -137,11 +137,11 @@ get_expected_data_for_get_regional_data_tests_with_level_2_regions <- function() data <- get_expected_data_for_get_regional_data_tests_only_level_1_regions() data <- data[, -3] data$region <- rep(c("Oneland", "Oneland", "Twoland", "USA", "Twoland"), 6) - region_codes <- tibble::tibble( + region_codes <- dplyr::tibble( iso_3166_2 = c("ON", "TW", "US"), region = c("Oneland", "Twoland", "USA") ) - level_2_region_codes <- tibble::tibble( + level_2_region_codes <- dplyr::tibble( iso_3166_2_province = c("NO", "EA", "SO", "WE", "VA"), region = c( "Northland", "Eastland", "Southland", @@ -168,11 +168,11 @@ get_expected_totals_data_for_get_regional_data_tests_with_level_2_regions <- fun data <- data[, -2] data$region <- c("Oneland", "USA", "Twoland", "Twoland", "Oneland") - region_codes <- tibble::tibble( + region_codes <- dplyr::tibble( iso_3166_2 = c("ON", "TW", "US"), region = c("Oneland", "Twoland", "USA") ) - level_2_region_codes <- tibble::tibble( + level_2_region_codes <- dplyr::tibble( iso_3166_2_province = c("NO", "EA", "SO", "WE", "VA"), region = c( "Northland", "Eastland", "Southland", @@ -188,7 +188,7 @@ get_expected_totals_data_for_get_regional_data_tests_with_level_2_regions <- fun recovered_total, hosp_total, tested_total ) - return(tibble::tibble(data)) + return(dplyr::tibble(data)) } @@ -199,7 +199,7 @@ get_expected_data_for_fill_empty_dates_with_na_test <- function() { dates <- c("2020-01-31", "2020-02-01", "2020-02-02", "2020-02-03") regions <- c("Northland", "Eastland", "Wisconsin") - region_codes <- tibble::tibble( + region_codes <- dplyr::tibble( region = regions, level_1_region_code = c("NO", "EA", "WI") ) @@ -213,7 +213,7 @@ get_expected_data_for_fill_empty_dates_with_na_test <- function() { dplyr::arrange(date, level_1_region) %>% dplyr::left_join(region_codes, by = c("level_1_region" = "region")) expected_data$cases <- c(1:5, rep(NA, 4), 10:12) - return(tibble::tibble(expected_data)) + return(dplyr::tibble(expected_data)) } get_input_data_for_complete_cumulative_columns_test <- function() { @@ -239,5 +239,5 @@ get_expected_data_for_complete_cumulative_columns_test <- function() { full_data_with_cum_cases_filled <- cbind(full_data_with_cum_cases_filled, as.integer(c(1, 5, 5, 15, 2, 7, 7, 18, 3, 3, 3, 15))) colnames(full_data_with_cum_cases_filled)[5] <- "cases_total" - return(tibble::tibble(full_data_with_cum_cases_filled)) + return(dplyr::tibble(full_data_with_cum_cases_filled)) } diff --git a/tests/testthat/test-csv_reader.R b/tests/testthat/test-csv_reader.R index c611980a..bc166e27 100644 --- a/tests/testthat/test-csv_reader.R +++ b/tests/testthat/test-csv_reader.R @@ -1,5 +1,5 @@ test_path <- "custom_data/mtcars.csv" -target <- tibble::as_tibble(head(mtcars)) +target <- dplyr::as_tibble(head(mtcars)) test_that("csv_reader can read in a simple dataset", { test <- csv_reader(test_path) diff --git a/tests/testthat/test-processing.R b/tests/testthat/test-processing.R index e40cbc08..10fdcc3c 100644 --- a/tests/testthat/test-processing.R +++ b/tests/testthat/test-processing.R @@ -12,31 +12,31 @@ test_that("default functions are called", { "add_extra_na_cols", function(x) dplyr::mutate(x, A = A + 2), ) - x <- tibble::tibble(A = c(1, 2, 3)) - expected <- tibble::tibble("A" = c(4, 5, 6)) + x <- dplyr::tibble(A = c(1, 2, 3)) + expected <- dplyr::tibble("A" = c(4, 5, 6)) expect_identical(expected, run_default_processing_fns(x)) }) test_that("optional functions can be empty", { - x <- tibble::tibble(A = c(1, 2, 3)) + x <- dplyr::tibble(A = c(1, 2, 3)) expect_identical(x, run_optional_processing_fns(x, c())) expect_identical(x, run_optional_processing_fns(x)) expect_identical(x, run_optional_processing_fns(x, NULL)) }) test_that("optional functions run", { - x <- tibble::tibble(A = c(1, 2, 3)) + x <- dplyr::tibble(A = c(1, 2, 3)) process_fns <- c(function(x) { return(dplyr::mutate(x, A = A^2)) }) expect_identical( - tibble::tibble(A = c(1, 4, 9)), + dplyr::tibble(A = c(1, 4, 9)), run_optional_processing_fns(x, process_fns) ) }) test_that("calculate_columns_from_existing_data returns correct results", { - input_data <- tibble::tibble( + input_data <- dplyr::tibble( "date" = seq.Date(as.Date("2020-01-01"), as.Date("2020-01-07"), by = 1), "level_1_region" = c(rep("A", 4), rep("B", 3)), "cases_new" = c(0, 1, NA_integer_, 1, 1, 1, 1), @@ -68,10 +68,10 @@ test_that("add_extra_na_cols is working", { test_that("set_negative_values_to_zero works", { dates <- c(rep(Sys.Date(), 100)) values <- 49:-50 - df <- tibble::tibble(date = dates, cases_total = values) + df <- dplyr::tibble(date = dates, cases_total = values) colnames(df) <- c("date", "cases_total") - df_expected <- tibble::tibble(date = dates, cases_total = c(49:0, rep(0, 50))) + df_expected <- dplyr::tibble(date = dates, cases_total = c(49:0, rep(0, 50))) df_actual <- set_negative_values_to_zero(df) expect_equal(df_actual, df_expected) })