# NOT RUN {
#############################################################################
# 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)
#############################################################################
# Creating affiliations
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)
# Editing an affiliation
edit_affiliation("Math Dept", department_name = "Mathematics Department")
# Creating authors
new_author(
given_names = "Rosetta",
last_name = "Stone",
affiliations = c(42, "Math"),
degree = "PhD",
email = "slab@rock.net",
phone = "867-555-5309",
id = 8888
)
new_author(
given_names = "Spiro",
last_name = "Agnew",
degree = "LLB",
affiliations = "Art D", id = 13
)
new_author(last_name = "Plato", id = 303)
# Editing an author, showcasing the removal of a text element (last_name)
edit_author(author = 303, given_names = "Plato", last_name = NA)
# Editing an author, showcasing the addition and removal of affiliations
edit_author("Spiro", affiliations = ~ -"Art D" + Math)
# Creating a project
new_project(
title = "Understanding the Construction of the United States",
short_title = "USA",
authors = c(13, "Stone"),
stage = 4,
deadline = "2055-02-28",
deadline_type = "submission",
parent_directory = "famous_studied/philosophers/rocks",
corresp_auth = "Stone",
current_owner = "agnew",
make_directories = TRUE,
status = "waiting on IRB"
)
# Editing a project, showcasing the addition and removal of authors
edit_project(
"Understanding",
short_title = "usa1",
authors = ~ + "303" - 13 - Stone
)
new_idea(title = "Boiling the Ocean")
# Wrapped in if (interactive()) because it requires interactive console input
# and fails automated package checking and testing.
if (interactive()) {
delete_project("usa1")
delete_author(303)
delete_affiliation("Math")
}
#############################################################################
# CLEANUP
Sys.setenv(HOME = old_home, PROJECTS_FOLDER_PATH = old_ppath)
# }
Run the code above in your browser using DataLab