{"id":14067608,"url":"https://github.com/robitalec/targets-parameterized-bookdown","last_synced_at":"2025-03-19T23:31:14.793Z","repository":{"id":109036219,"uuid":"327433172","full_name":"robitalec/targets-parameterized-bookdown","owner":"robitalec","description":":hammer_and_wrench: Example repository for rendering a bookdown book, compiling parameterized RMarkdown documents, using the targets package","archived":false,"fork":false,"pushed_at":"2021-03-20T04:15:32.000Z","size":34,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T21:49:05.257Z","etag":null,"topics":["bookdown","bookdown-book","r","rmarkdown","targets"],"latest_commit_sha":null,"homepage":"","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}},"created_at":"2021-01-06T21:28:18.000Z","updated_at":"2022-12-06T15:40:18.000Z","dependencies_parsed_at":"2023-03-25T20:48:21.204Z","dependency_job_id":null,"html_url":"https://github.com/robitalec/targets-parameterized-bookdown","commit_stats":null,"previous_names":[],"tags_count":2,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Ftargets-parameterized-bookdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Ftargets-parameterized-bookdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Ftargets-parameterized-bookdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Ftargets-parameterized-bookdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robitalec","download_url":"https://codeload.github.com/robitalec/targets-parameterized-bookdown/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244031029,"owners_count":20386534,"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":["bookdown","bookdown-book","r","rmarkdown","targets"],"created_at":"2024-08-13T07:05:41.242Z","updated_at":"2025-03-19T23:31:14.510Z","avatar_url":"https://github.com/robitalec.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# targets-parameterized-bookdown\n\n\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4624556.svg)](https://doi.org/10.5281/zenodo.4624556)\n\n\nExample repository for rendering a bookdown book, compiling parameterized\nRmarkdown documents, using the [targets](https://github.com/wlandau/targets)\npackage.\n\n\nThis example extends the\n[targets-minimal](https://github.com/wlandau/targets-minimal) example. To mimic\na directory of input files, we split the example data into two chunks.\n\n``` r\nlibrary(tidyverse)\ndata \u003c- read_csv('data/raw_data.csv')\n\nnrows \u003c- 50\n\ndata1 \u003c- head(data, n = nrows)\ndata2 \u003c- tail(data, n = nrows)\n\nwrite_csv(data1, 'data/split/data1.csv')\nwrite_csv(data2, 'data/split/data2.csv')\n```\n\nTo setup a target for our input files, we use `tar_files` from\n[tarchetypes](https://github.com/wlandau/tarchetypes) (target: paths). Dynamic branching in\nsubsequent targets is mapped over these files (targets: raw_data, data, hist, fit).\n\nParameterized RMarkdown documents are generated by mapping over the fitted model\nand histograms using a template document (`template/template.Rmd`) (target: report).\n\nFinally, the output documents are merged into a book with bookdown. We use a\ncustom wrapper function `render_with_deps` to explicitly declare the book's\ndependency on the output reports (target: book).\n\n\n\n\n## Notes\n\n* We need to change the extension of the parameterized github_document outputs \n(target: report) from `.md` to `.Rmd` because `bookdown` doesn't pick up `.md` files \nunless they are explicitly listed with the `rmd_files` argument in `_bookdown.yml`. \nSee [here](https://github.com/rstudio/bookdown/issues/956).\n\n* The `title` and `output_file` for rendered RMarkdown documents are set in this\nexample to the name of the branch  (target: report). If adapted for your own use, this could\nalternatively be set to an id from the data, etc. \n\n* We can't use the `tar_render` function from `tarchetypes` because we need to \ncall `bookdown::render_book` and not `rmarkdown::render` (target: book). \nTherefore, we need to track the `.Rmd` files in separate targets. \n\n* You *may* need to use `pandoc` \u003e= [2.11.2](https://pandoc.org/releases.html#pandoc-2.11.2-2020-11-19) when generating the github_documents (target: report) so ATX style headings are used by default.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobitalec%2Ftargets-parameterized-bookdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobitalec%2Ftargets-parameterized-bookdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobitalec%2Ftargets-parameterized-bookdown/lists"}