email_authors: Write an email to project authors

Description Usage Arguments Details See Also Examples

View source: R/email_authors.R

Description

Invokes utils::browseURL("mailto://[author emails]") for a specified project, or for the currently open project if project is left as NULL.

Usage

1
2
3
4
5
email_authors(
  project = NULL,
  browser = getOption("browser"),
  encodeIfNeeded = FALSE
)

Arguments

project

Project id or unambiguous substring of the project name from the projects() table. Defaults to NULL (see Details).

browser, encodeIfNeeded

See utils::browseURL().

Details

The success of this function depends on the platform and the specified browser. See the Details and URL schemes sections of utils::browseURL().

If project = NULL, the function selects the project in the projects() table whose path is equal to rstudioapi::getActiveProject().

See Also

utils::browseURL(); rstudioapi::getActiveProject() for information on browser and encodeIfNeeded arguments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Wrapped in if (interactive()) because this function is interactive by nature.
if (interactive()) {

  # If you have a projects() project open, just run it:
  email_authors()

  # Otherwise, specify a project:

  ###########################################################################
  # Setup
  old_home <- Sys.getenv("HOME")
  old_ppath <- Sys.getenv("PROJECTS_FOLDER_PATH")
  temp_dir <- tempfile("dir")
  dir.create(temp_dir)
  Sys.unsetenv("PROJECTS_FOLDER_PATH")
  Sys.setenv(HOME = temp_dir)
  setup_projects(path = temp_dir)
  new_author("Rhonda", "Rondale", email = "ronda.rondale@co.uk")
  new_author("Betty", "Betts", email = "betty@co.uk")
  new_project("Inventing the Ring of Power", authors = c("Betty", "Ron"))
  ###########################################################################

  email_authors("Ring of Power")

  ###########################################################################
  # Cleanup (or just restart R)
  Sys.setenv(HOME = old_home, PROJECTS_FOLDER_PATH = old_ppath)
}

projects documentation built on April 24, 2021, 5:06 p.m.