{"id":16272856,"url":"https://github.com/robitalec/2023-csee-reproducible-workflows-workshop","last_synced_at":"2025-04-08T15:50:52.824Z","repository":{"id":174310592,"uuid":"639974312","full_name":"robitalec/2023-CSEE-reproducible-workflows-workshop","owner":"robitalec","description":":memo: Developing a reproducible workflow in R using functions, {targets} and {renv}","archived":false,"fork":false,"pushed_at":"2023-07-14T19:18:52.000Z","size":4592,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T12:30:35.456Z","etag":null,"topics":["conflicted","functions","projects","r","renv","reproducibility","targets","targets-pipeline"],"latest_commit_sha":null,"homepage":"https://robitalec.github.io/2023-CSEE-reproducible-workflows-workshop/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robitalec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-12T16:58:36.000Z","updated_at":"2024-04-19T13:55:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4d71d22-9b51-4b61-b779-b76ae1606765","html_url":"https://github.com/robitalec/2023-CSEE-reproducible-workflows-workshop","commit_stats":null,"previous_names":["robitalec/2023-csee-reproducible-workflows-workshop"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2F2023-CSEE-reproducible-workflows-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2F2023-CSEE-reproducible-workflows-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2F2023-CSEE-reproducible-workflows-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2F2023-CSEE-reproducible-workflows-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robitalec","download_url":"https://codeload.github.com/robitalec/2023-CSEE-reproducible-workflows-workshop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247877442,"owners_count":21011152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conflicted","functions","projects","r","renv","reproducibility","targets","targets-pipeline"],"created_at":"2024-10-10T18:19:41.638Z","updated_at":"2025-04-08T15:50:52.800Z","avatar_url":"https://github.com/robitalec.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reproducible workflows workshop\n\nWorkshop at [CSEE 2023](https://www.beepeg2023.ca/): developing a reproducible workflow in R using functions, {targets} and {renv}\n\nDeveloped and delivered by:\n\n- Alec L. Robitaille (Memorial University of Newfoundland and Labrador)\n- Isabella C. Richmond (Concordia University)\n\n\n## Schedule\n\nProjects\n\n-   Directories\n-   READMEs\n-   RStudio Projects\n\n*Short break*\n\nFunctions\n\n-   Introduction\n-   Recommended approach\n-   Checks\n-   Options\n\n*Lunch break*\n\n{targets}\n\n-   Introduction\n-   Writing workflows\n-   Visualizing\n-   Running workflows\n-   Extensions\n\n*Short break*\n\n{renv} + {conflicted}\n\n-   Saving package versions\n-   Checking conflicts\n\n\n## Learning goals\n\nOverall\n\n-   Approach analyses in a more holistic way (whole project vs script by script)\n-   Share data across projects and software versions with minimal stress \n-   Use workflows that reduce analysis errors and mental load\n\nSection 1: Projects\n\n-   Construct a RStudio project that is thoroughly documented using file structure and data management best practices\n-   Use RStudio projects to effectively share their own work, and use other people's\n\nSection 2: Functions\n\n-   Read and understand structure of functions in R\n-   Refactor code into functions that do one thing\n-   Add tests and checks to ensure functions work and error when expected\n-   Recognize the value of functions as chunks of code that are reusable and easier to debug\n\nSection 3: {targets}\n\n-   (For a given project) map out relationships between inputs, outputs and analysis steps\n-   Identify discrete chunks/steps and write corresponding (or use available) functions \n-   Execute a workflow in {targets} that reads in data, performs a function, and saves an output\n-   Recognize the value of workflows for reducing mental load and improving efficiency\n\nSection 4: {renv} + {conflicted}\n\n-   Use {renv} to preserve current package versions to ensure the environment is reproducible, portable and isolated\n-   Use {conflicted} to detect conflicting function names\n\n\n## Setup\n\nThis workshop is aimed at improving our ability to use and create *reproducible workflows.* All the materials should be accessible from the side bar (slides, exercises, resources for further reading, and the link to the GitHub repository can be accessed by clicking on the GitHub icon).\n\nWe don't have any strict dependencies on specific versions of R or R packages, but it would be good to have at least R version 4.0 and a recent version of RStudio. \n\nWe are using Quarto to build the workshop's website and exercises, so it could be helpful for you to install it too. If you don't have time to, you can always complete exercises in an R script - so no pressure. \n\nInstall first the Quarto CLI from the [here](https://quarto.org/docs/get-started/) then the package with the command at the bottom.\n\n\nPlease install the following packages (after updating R):\n\n```r\npkgs \u003c- c(\n  'targets',\n  'igraph',\n  'data.table',\n  'dplyr',\n  'ggplot2',\n  'testthat',\n  'janitor',\n  'renv',\n  'rlang',\n  'conflicted',\n  'palmerpenguins',\n  'visNetwork',\n  'quarto',\n  'xml2',\n  'downlit',\n  'usethis'\n)\n\ninstall.packages(pkgs)\n```\n\n\nTo download the workshop materials for a participant, use this command:\n\n```r\nlibrary(usethis)\n\n# (Set your own destination directory)\nuse_course(\n    'https://github.com/robitalec/2023-CSEE-reproducible-workflows-workshop/archive/refs/heads/participant.zip', \n    destdir = '~/Documents')\n```\n\nOr by downloading and unziping the ZIP file at this link: \u003chttps://github.com/robitalec/2023-CSEE-reproducible-workflows-workshop/archive/refs/heads/participant.zip\u003e. \n\nThen open up the RStudio project. \n\n## Data\n\nExample data for this workshop is borrowed from the Palmer Long-Term Ecological Research (LTER). Here is the study description from the [Palmer LTER site](https://pallter.marine.rutgers.edu/):\n\n\u003e  The Palmer Long-Term Ecological Research (LTER) study area is located to the west of the Antarctic Peninsula extending South and North of the Palmer Basin from onshore to several hundred kilometers off shore. Palmer Station is one of the three United States research stations located in Antarctica. It is on Anvers Island midway down the Antarctic Peninsula at latitude 64.7 South, longitude 64.0 West.\n\n\u003e The Palmer LTER studies a polar marine biome with research focused on the Antarctic pelagic marine ecosystem, including sea ice habitats, regional oceanography and terrestrial nesting sites of seabird predators. The Palmer LTER is one of more than 26 LTER research sites located throughout the United States, Puerto Rico and Tahiti; each focused on a specific ecosystem, that together constitute the LTER Network.\n\nWe gratefully acknowledge the Palmer LTER for releasing data freely and openly for diverse uses - in our case for training analytical skills of researchers in ecology.  \n\n\n### Penguins\n\nThe first dataset is already available in R through the [`palmerpenguins` R package](https://allisonhorst.github.io/palmerpenguins/). There is a raw version and a cleaned version. They contain data for 344 penguins, with the following variables (cleaned version):\n\n- species\n- island\n- bill_length_mm\n- bill_depth_mm\n- flipper_length_mm\n- body_mass_g\n- sex\n- year\n\n### Weather timeseries\n\nThe following datasets are available directly from the [Palmer LTER Data Catalog](https://pallter.marine.rutgers.edu/catalog/edi/). To download the data to the `raw-data/` directory, run the function `download_example_data()` (`R/download_example_data.R`). \n\nThis second dataset contains monthly averaged weather timeseries from Palmer Station, Antarctica, with the following variables: \n\n- Date  \n- Year  \n- Month  \n- Average Temperature  \n- Temperature Count  \n- Average Pressure  \n- Pressure Count  \n- Average Melted Precipitation  \n- Precipitation Count  \n\n[Data package summary](https://portal.edirepository.org/nis/mapbrowse?packageid=knb-lter-pal.189.8)\n\n[Data package metadata](https://portal.edirepository.org/nis/metadataviewer?packageid=knb-lter-pal.189.8)\n\nLink to data (CSV): \n\n[https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.189.8\u0026entityid=ab357b4c92531a07d98ff1c4f4809a1e](https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.189.8\u0026entityid=ab357b4c92531a07d98ff1c4f4809a1e)\n\n\n\n### Monthly sea ice area\n\nThe third dataset contains monthly sea ice area from the region around the Palmer Station, Antarctica, with the following variables:\n\n- Year\n- Month\n- Area\n\nNote: this data is formatted with months as columns, years as rows, and cells filled with the corresponding area. \n\n\n[Data package summary](https://portal.edirepository.org/nis/mapbrowse?packageid=knb-lter-pal.34.7)\n\n[Data package metadata](https://portal.edirepository.org/nis/metadataviewer?packageid=knb-lter-pal.34.7)\n\nLink to data (TXT): \n\n[https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.34.7\u0026entityid=0fccb4e99aaa0c0cc85c23284288ec81](https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.34.7\u0026entityid=0fccb4e99aaa0c0cc85c23284288ec81)\n\n\n\n### Adelie penguin adult and chick counts\n\nThe fourth dataset contains Adelie penguin adult and chick counts\n\n- studyName  \n- Date GMT  \n- Time GMT  \n- Island  \n- Colony  \n- Adults  \n- Chicks\n\n[Data package summary](https://portal.edirepository.org/nis/mapbrowse?packageid=knb-lter-pal.88.8)\n\n[Data package metadata](https://portal.edirepository.org/nis/metadataviewer?packageid=knb-lter-pal.88.8)\n\nLink to data (CSV): \n\n[https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.88.8\u0026entityid=b4062890db09a72628786650dacfbf1f](https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-pal.88.8\u0026entityid=b4062890db09a72628786650dacfbf1f)\n\n\n\n## LICENSE\n\nThis project is released under the GNU General Public License v3.0. Read it [here](https://github.com/robitalec/2023-CSEE-reproducible-workflows-workshop/blob/quarto/devel/LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobitalec%2F2023-csee-reproducible-workflows-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobitalec%2F2023-csee-reproducible-workflows-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobitalec%2F2023-csee-reproducible-workflows-workshop/lists"}