project: Create or open Project(s)

Description Usage Arguments Details Value Examples

View source: R/project.R

Description

Creates or retrieves a Project or multiple Projects from a SsimLibrary.

Usage

1
2
3
4
5
6
7
8
project(
  ssimObject = NULL,
  project = NULL,
  sourceProject = NULL,
  summary = NULL,
  forceElements = FALSE,
  overwrite = FALSE
)

Arguments

ssimObject

Scenario or SsimLibrary object, or a character string (i.e. a filepath)

project

Project object, character, integer, or vector of these. Names or ids of one or more Projects. Note that integer ids are slightly faster (optional)

sourceProject

Project object, character, or integer. If not NULL (default), new Projects will be copies of the sourceProject

summary

logical. If TRUE then return the Project(s) in a data.frame with the projectId, name, description, owner, dateModified, readOnly. Default is TRUE if project=NULL and SsimObject is not Scenario/Project, FALSE otherwise

forceElements

logical. If TRUE then returns a single Project as a named list; otherwise returns a single project as a Project object. Applies only when summary=FALSE Default is FALSE

overwrite

logical. If TRUE an existing Project will be overwritten. Default is FALSE

Details

For each element of project:

Value

Returns a Project object representing a SyncroSim Project. If summary is TRUE, returns a data.frame of Project names and descriptions.

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
# Set the file path and name of the new SsimLibrary
myLibraryName <- file.path(tempdir(),"testlib_project")

# Set the SyncroSim Session, SsimLibrary, and Project
mySession <- session()
myLibrary <- ssimLibrary(name = myLibraryName, session = mySession) 
myProject <- project(ssimObject = myLibrary, project = "My project name")
myproject2 <- project(ssimObject = myLibrary, project = "My new project name")

# Get a named list of existing Projects
# Each element in the list is named by a character version of the Project ID
myProjects <- project(myLibrary, summary = FALSE)
names(myProjects)

# Get an existing Project.
myProject <- myProjects[[1]]
myProject <- project(myLibrary, project = "My new project name")

# Get/set the Project properties
name(myProject)
name(myProject) <- "New project name"

# Create a new Project from a copy of an existing Project
myNewProject <- project(myLibrary, project = "My copied project",
                        sourceProject = 1)

# Overwrite an existing Project
myNewProject <- project(myLibrary, project = "My copied project",
                        overwrite = TRUE)

rsyncrosim documentation built on Oct. 28, 2021, 1:07 a.m.