display_metadata: View the 'projects()', 'authors()', and 'affiliations()'...

Description Usage Arguments Details Value Examples

Description

Returns a table of the projects/authors/affiliations, filtered and joined according to the entirely optional arguments.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
affiliations(affiliation, authors = FALSE)

authors(author, affiliations = FALSE, projects = FALSE)

projects(
  project,
  all_stages = FALSE,
  exclude = c(0L, 6L),
  path = NULL,
  archived = FALSE,
  verbose = FALSE,
  authors = FALSE
)

ideas(project, archived = FALSE, verbose = FALSE, authors = FALSE)

manuscripts(project, archived = FALSE, verbose = FALSE, authors = FALSE)

Arguments

projects, authors, affiliations

Logical values indicating whether or not to perform a left join with another metadata tibble. All FALSE by default.

project, author, affiliation

An optional unique vector of ids and/or names. Only rows matching one or more entries will be returned. This is the one setting in which the package does not return throw an error if user input matches multiple projects.

all_stages

Logical, indicating whether or not to include projects of all stages, overriding the exclude argument.

exclude

A vector of numbers or character strings that can be validated against the list of project stages:

0: idea
1: design
2: data collection
3: analysis
4: manuscript
5: under review
6: accepted

Ignored if all_stages = TRUE

path

A single file path of a directory within the main projects folder; only projects whose folder is in this directory will be returned.

archived

Logical, indicating whether or not to include projects that have been archived using archive_project(). FALSE by default.

verbose

Logical, indicating whether or not to return all columns of the projects(); if FALSE, only the id, current_owner, status, and stage columns are returned. Defaults to FALSE.

Details

ideas() is a shortcut for projects(exclude = 1:6) (including only projects of stage 0: idea).

manuscripts() is a shortcut for projects(exclude = c(0:3, 6)) (yielding only projects of stage 4: manuscript and 5: under review).

If one or more of the projects, authors, or affiliations arguments is set to TRUE, a dplyr::left_join() is performed, with the "left" table being the one sharing the name of the function being used. As such, rows that don't have matches in any other tables will still show up in the output, and rows that have multiple matches in other tables will yield multiple rows in the output. The "right" table's id column will be renamed.

Value

A tibble.

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#############################################################################
# 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_affiliation(department_name = "Math Dept.",
                institution_name = "Springfield College",
                address = "123 College St, Springfield, AB")
new_affiliation(department_name = "Art Department",
                institution_name = "Springfield College",
                address = "321 University Boulevard, Springfield, AB",
                id = 42)
new_affiliation(department_name = "Central Intelligence Agency",
                institution_name = "United States Government",
                address = "888 Classified Dr, Washington DC")
new_affiliation(department_name = "Pyrotechnics",
                institution_name = "ACME")
new_author(given_names = "Spiro", last_name = "Agnew", degree = "LLB",
           affiliations = "Art D", id = 13)
new_author(given_names = "Plato", id = 303)
new_author(given_names = "Condoleezza", last_name = "Rice",
           affiliations = c(1, 42, "Agency", "ACME"))
new_project(title = "Test project 1", current_owner = "Plato", stage = 1)
new_project(title = "Test project 2", current_owner = "eezza", stage = 2)
new_project(title = "Test project 3", current_owner = "Plato", stage = 3)
new_project(title = "Fun project 4",  current_owner = "Rice", stage = 4)
new_project(title = "Fun project 5",  current_owner = "Rice", stage = 5)
new_project(title = "Fun project 6",  current_owner = "Rice", stage = 6)
new_project(title = "Good idea",  current_owner = "Rice", stage = 0)
#############################################################################

# View entire affiliations table
affiliations()

# View authors table joined to affiliations table
# Notice that multiple rows are created for each affiliation-author combination
authors(affiliations = TRUE)

# View only active projects with "Fun" in their title.
projects("Fun")

# View all projects with "Rice" as the current_owner
projects(all_stages = TRUE) %>% dplyr::filter(current_owner == "Rice")

# View manuscripts
manuscripts()

# View ideas
ideas()

# Wrapped in if (interactive()) because it requires interactive console input
# and fails automated testing.
if (interactive()) {
  # Archive Fun project 5
  archive_project("Fun project 5")

  # Default behavior is to not include archived projects in projects() table
  projects("Fun")
  projects("Fun", archived = TRUE)
}

#############################################################################
# CLEANUP
# (or, the user can just restart R)
Sys.setenv(HOME = old_home, PROJECTS_FOLDER_PATH = old_ppath)

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