Skip to contents

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 to take advantage of the R interface provided by the googlesheets4 package.

First, you’ll need to create a spreadsheet. plm_template() provides a default template for that purpose.

library(googlesheets4)

gs4_create(
  name = "encyclopédie",
  sheets = plm_template()
)

The above will create a sheet named encyclopédie 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.

Once the sheet is online, use read_sheet() to read it in R.

read_sheet(gs4_find("encyclopédie"))

Set up

Plume

If you use Plume, put the code directly in your R Markdown or Quarto document as shown in the example below:

---
title: An awesome publication
execute:
  echo: false
---

```{r}
#| label: setup
#| include: false

library(googlesheets4)
library(plume)

tbl_authors <- gs4_find("sheet_name") |> read_sheet()

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.

library(googlesheets4)
library(plume)

tbl_authors <- gs4_find("sheet_name") |> read_sheet()

PlumeQuarto$new(tbl_authors, file = "file.qmd")$
  set_corresponding_authors(1)$
  to_yaml()

Remember to run the script everytime the spreadsheet is updated to implement the changes in your document.