--- title: "plume workflow" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{plume workflow} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ## Data plume is designed to work with spreadsheets, which makes it easy to store, maintain and share data with co-authors. I recommend using [Google Sheets](https://docs.google.com/spreadsheets/) to take advantage of the R interface provided by the [googlesheets4](https://googlesheets4.tidyverse.org) package. First, you'll need to create a spreadsheet. `plm_template()` provides a default template for that purpose. ```{r eval = FALSE} library(googlesheets4) gs4_create( name = "authors", sheets = plm_template() ) ``` The above will create a sheet named `authors` with the columns defined by `plm_template()`. Enter your information and share the sheet with your collaborators so they can add theirs too. Note that if it's the first time you use googlesheets4, you'll need to grant the package permission to work with Google Sheets. You can read more about googlesheets4 authentication [here](https://googlesheets4.tidyverse.org/reference/gs4_auth.html). Once the sheet is online, use `read_sheet()` to read it in R. ```{r eval = FALSE} read_sheet(gs4_find("authors")) ``` ## Set up ### Plume If you use `Plume`, put the code directly in your R Markdown or Quarto document as shown in the example below: ````{verbatim} --- title: An awesome publication execute: echo: false --- ```{r} #| label: setup #| include: false library(googlesheets4) library(plume) tbl_authors <- read_sheet(gs4_find("sheet_name")) aut <- Plume$new(tbl_authors) aut$set_corresponding_authors(1) ``` `r aut$get_author_list("^a,^co")` ```{r} #| results: asis aut$get_affiliations() |> cat(sep = "\n\n") ``` \*Correspondence to: `r aut$get_contact_details()` ## Main text Lorem ipsum... ## Contributions ```{r} #| results: asis aut$get_contributions() |> cat(sep = "; ") ``` ```` To modify author data, simply edit the spreadsheet. All author information in the document will update automatically the next time you render it. ### PlumeQuarto If you use `PlumeQuarto` to inject author information in a Quarto document, you'll have to pass the data from a separate R script. ```{r, eval = FALSE} library(googlesheets4) library(plume) tbl_authors <- read_sheet(gs4_find("sheet_name")) aut <- PlumeQuarto$new(tbl_authors, file = "file.qmd") aut$set_corresponding_authors(1) aut$to_yaml() ``` Remember to run the script everytime the spreadsheet is updated to implement the changes in your document.