{"id":20667877,"url":"https://github.com/statnmap/teach-package-dev-rmdfirst","last_synced_at":"2025-04-19T17:09:51.354Z","repository":{"id":39988710,"uuid":"333968853","full_name":"statnmap/teach-package-dev-rmdfirst","owner":"statnmap","description":"Tutorial: How to build a package following Rmd First Method with {fusen}","archived":false,"fork":false,"pushed_at":"2022-05-19T21:36:45.000Z","size":24183,"stargazers_count":10,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-01T14:48:42.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://statnmap.github.io/teach-package-dev-rmdfirst//stagiaire_complet.html","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statnmap.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-28T22:07:20.000Z","updated_at":"2024-05-01T14:48:42.879Z","dependencies_parsed_at":"2022-09-13T19:31:20.237Z","dependency_job_id":null,"html_url":"https://github.com/statnmap/teach-package-dev-rmdfirst","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2Fteach-package-dev-rmdfirst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2Fteach-package-dev-rmdfirst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2Fteach-package-dev-rmdfirst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statnmap%2Fteach-package-dev-rmdfirst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statnmap","download_url":"https://codeload.github.com/statnmap/teach-package-dev-rmdfirst/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224964641,"owners_count":17399434,"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":[],"created_at":"2024-11-16T19:45:26.312Z","updated_at":"2024-11-16T19:45:26.842Z","avatar_url":"https://github.com/statnmap.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\"\n)\n```\n\n# How to build a package with \"Rmd First\" method\n\n\u003e Build reproducible and shareable data analyses using R packages\n\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nThis repository contains the course material of our [useR! 2021 tutorial](https://user2021.r-project.org/), then [AFH 2022](https://www.association-francaise-halieutique.fr).\n\nInstructors: [Sébastien Rochette](https://statnmap.com), Florence Mounier\n\n## Tutorial purpose\n\nThe tutorial is designed for R users from a variety of fields who are interested in organizing their analyses or development, usually written in RMarkdown files, into R packages. \n\n## Modifications\n\nPlease use a branch to add modifications and open a merge request to ask to add them in the _master_. You can assign me to this.\n\n## Content of this repository\n\n- `courses/`: Rmd for different courses\n- `data/`: shapefiles and data used in the slides and in exercises\n- `exercises/` : Rmd of the exercises with complete answers\n- `submission.Rmd` : Tutorial submission\n\n## What we proposed\n\n### Abstract\n\n\"Rmd First\" method can reduce mental load when building packages by keeping users in a natural environment, using a tool they know: a RMarkdown document. \n\nThe step between writing your own R code to analyze some data and refactoring it into a well-documented, ready-to-share R package seems unreachable to many R users.\nThe package structure is sometimes perceived as useful only for building general-purpose tools for data analysis to be shared on official platforms.\nHowever, packages can be used for a broader range of purposes, from internal use to open-source sharing. \nBecause packages are designed for robustness and enforce helpful standards for documentation and testing, the package structure provides a useful framework for refactoring analyses and preparing them to go into production. \nThe following approach to write a development or an analysis inside a Rmd, will significantly reduce the work to transform a Rmd into a package : \n\n- _Design_ : define the goal of your next steps and the tools needed to reach them\n- _Prototype_ : use some small examples to prototype your script in Rmd\n- _Build_ : Build your script as functions and document your work to be able to use them, in the future, on real-life datasets\n- _Strengthen_ : Create tests to assure stability of your code and follow modifications through time\n- _Deploy_ : Transform as a well-structured package to deploy and share with your community\n\nDuring this tutorial, we will work through the steps of Rmd Driven Development to persuade attendees that their experience writing R code means that they already know how to build a package. They only need to be in a safe environment to find it out, which will be what we propose.\nWe will take advantage of all existing tools such as {devtools}, {testthat}, {attachment} and {usethis} that ease package development from Rmd to building a package.\nThe recent package [{fusen}](https://thinkr-open.github.io/fusen), which \"inflates a package from a simple flat Rmd\", will be presented to further reduce the step between well-designed Rmd and package deployment. \nAttendees will leave this workshop having built their first package with the \"Rmd First\" method and with the skills and tools to build more packages on their own.\n\n### The learning goals\n\nBy the end of the tutorial participants should:\n\n- understand the methodology proposed by Rmd Driven Development\n- be able to refactor their code into correctly formatted functions\n- understand the structure of a package\n- be able to build a documented and tested R package\n- know how to share their work with the community on GitHub\n\n## What can you do after this tutorial?\n\n- Practice again, following complementary 'Rmd-first' / 'RMDD' presentations\n  + https://rtask.thinkr.fr/when-development-starts-with-documentation/\n  + https://emilyriederer.netlify.com/post/rmarkdown-driven-development/\n  + https://malco.io/talk/you-re-already-ready-zen-and-the-art-of-r-package-development-rsg/\n  \n- Try [\"{fusen}: inflate a package from a simple flat Rmd\"](https://rtask.thinkr.fr/fusen-create-a-package-from-a-single-rmarkdown-file/)\n\n# For instructors\n\nThe content will be built using an internal ThinkR package called {formation}.\nThis ensures that the HTML output, datasets, and extra files are stored in the correct place to be added to the ThinkR e-learning platform.  \nEach instructor is still able to locally knit each chapter using {xaringan}.  \nThe content of the course is:  \n\n- courses/C00-package-objectives.en.Rmd: What we will present during this tutorial, and how it will be held\n- courses/00-cruz.Rmd: How the e-learning platform works\n- courses/C00-package_preambule.en.Rmd: What means package first ?\n- courses/C01a-package_fusen_discover.en.Rmd: Discover the structure of a package with {fusen}\n- courses/C01b-package_express_fusen.en.Rmd: Build a package using {fusen}\n\u003c!-- - courses/C06-pkg_avance_test.Rmd: Go further with unit tests --\u003e\n- courses/C09-pkg_avance_data.en.Rmd: Include datasets in your package\n- courses/C13-git_fusen.en.Rmd: Use git with {fusen} projects\n- courses/C14-data-analyses-packages.en.Rmd: What about data analyses in a package?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatnmap%2Fteach-package-dev-rmdfirst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatnmap%2Fteach-package-dev-rmdfirst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatnmap%2Fteach-package-dev-rmdfirst/lists"}