email_authors {projects}R Documentation

Write an email to project authors

Description

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

Usage

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

# 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)
}

[Package projects version 2.1.3 Index]