orderly_latest: Find most recent report

Description Usage Arguments Value See Also Examples

View source: R/query.R

Description

Find most recent version of an orderly report. The most recent report is always the most recently run report that has been committed (regardless of the order in which they were committed).

Usage

1
2
3
4
5
6
7
orderly_latest(
  name = NULL,
  root = NULL,
  locate = TRUE,
  draft = FALSE,
  must_work = TRUE
)

Arguments

name

Name of the report to find; if NULL returns the most recent report across all names

root

The path to an orderly root directory, or NULL (the default) to search for one from the current working directory if locate is TRUE.

locate

Logical, indicating if the configuration should be searched for. If TRUE and config is not given, then orderly looks in the working directory and up through its parents until it finds an orderly_config.yml file.

draft

Should draft reports be used searched? Valid values are logical (TRUE, FALSE) or use the string newer to use draft reports where they are newer than archive reports. For consistency, always and never are equivalent to TRUE and FALSE, respectively.

must_work

Throw an error if no report is found. If FALSE, returns NA_character_.

Value

A character string with the id of the most recent report

See Also

orderly_list and orderly_list_archive for listing report names and versions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
path <- orderly::orderly_example("minimal")
id1 <- orderly::orderly_run("example", root = path, echo = FALSE)
id2 <- orderly::orderly_run("example", root = path, echo = FALSE)

# With no reports committed there is no latest report:
orderly::orderly_latest("example", root = path, must_work = FALSE)

# Commit the first report and it will be reported as latest:
orderly::orderly_commit(id1, root = path)
orderly::orderly_latest("example", root = path)

# Commit the second report and it will be reported as latest instead:
orderly::orderly_commit(id2, root = path)
orderly::orderly_latest("example", root = path)

orderly documentation built on June 17, 2021, 5:08 p.m.