createProject: Create, open or save a StoX project

Description Usage Arguments Value Examples

Description

createProject creates a new StoX project (from xml files).

openProject opens a StoX project. If the project has already been opened, openProject will only retrieve the project object from the RstoxEnv enviromnent. To force open the project use reopenProject.

reopenProject re-opens a StoX project, which is equivalent to closeing and then opening the project.

getProject gets a project object (one of "project", "baseline", "baseline-report", "name"), either from the input if this is a baseline or project object, or from the project environment.

listOpenProjects lists all open projects.

updateProject updates links to xml files in a project.

modifyProject modifies a project by the inpputs parlist and ... (reopens, modifies, saves and optionally closes the project).

saveProject saves a StoX project. This implies to save to the project.XML file all changes that are made to the project environment, such as changes in parameter values through the "..." input to runBaseline(). Such changes are only implemented in the project environment (in R memory), and will not be saved to the project.XML file unless saveProject() is run.

saveasProject saves the project as a new project (settings in Java memory are saved to the new project but not to the existing project).

resetProject resets a project to the original settings.

closeProject removes the project from memory.

closeAllProjects removes all projects from memory.

isProject checks whether the project exists on file.

getAvailableProjects lists available projects.

readXMLfiles reads XML data via a temporary project.

Usage

 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
createProject(projectName = NULL, files = list(), dir = NULL,
  model = "StationLengthDistTemplate", ow = NULL, open = TRUE,
  ignore.processXML = FALSE, parlist = list(), msg = TRUE, ...)

openProject(projectName = NULL, out = c("project", "baseline",
  "baseline-report", "name"), msg = FALSE)

reopenProject(projectName, out = c("project", "baseline",
  "baseline-report", "name"))

getProject(projectName, out = c("project", "baseline", "baseline-report",
  "name"), msg = FALSE)

listOpenProjects()

updateProject(projectName, relative.path = TRUE, close = FALSE)

modifyProject(projectName, close = TRUE, parlist = list(), ...)

saveProject(projectName, soft = FALSE)

saveasProject(projectName, newProjectName, dir = NULL, ow = NULL,
  msg = TRUE)

resetProject(projectName, to = "original")

closeProject(projectName)

closeAllProjects()

isProject(projectName, subset.out = FALSE)

getAvailableProjects()

readXMLfiles(files, dir = tempdir(), model = list(), nchars = 500)

Arguments

projectName

The name or full path of the project, a baseline object (as returned from getBaseline or runBaseline), og a project object (as returned from openProject). For createProject, projectName=NULL (the default) returns available templates, and for openProject, zeros length projectName returns all StoX projects in the default workspace either given as a vector of full paths, or, in the case projectName is an empty list, a list of names of StoX projects located in the default workspace and sub directories. Projects locataed in sub directories of the default workspace can be given by the relative path, or are searched for by name.

files

A list with elements named "acoustic", "biotic", "landing", "process" (holding the project.xml file) or other implemented types of data to be copied to the project (available data types are stored in Definitions$StoX_data_sources in the environment "RstoxEnv". Get these by getRstoxDef("StoX_data_sources"). These could be given as directories, in which case all files within the directories are copied, or as URLs. If given as a single path to a directory holding sub-directories with names "acoustic", "biotic", "landing", "process" or other implemented types of data, the files are copied from these directories. If files has length 0 (default), no files are written to the project except the project.xml file using the specified model. If multiple projects are created, the files are copied to all projects. If given as a single URL to a zipped StoX project, the project is downloaded and unzipped, usting the

dir

The directory in which to put the project. The project is a directory holding three sub directories named "input", "output" and "process", where input, output and process files are stored.

model

The model to use, either given as a string specifying a template, or a vector of process names or list of processes given as lists of parameter specifications (see parlist). Show available templates with createProject().

ow

Specifies whether to ovewrite existing project: If TRUE, overwrite; if FALSE, do not overwrite; if NULL (default), aks the user to confitm overwriting.

open

Logical: if TRUE (defalut) open the project in memory.

ignore.processXML

Logical: if TRUE do not copy any project.XML file given in files to the project.

parlist, ...

See runBaseline.

msg

Logical: If TRUE, print messages to the console.

out

One of "project", "baseline" or "name" (project name), specifying the output.

relative.path

Logical: If TRUE, update the project.xml file with the relative paths in Read* functions.

close

Logical: If TRUE, close the project after updating file paths (used in updateProject).

soft

Logical: If TRUE, do not save the current javaParameters to the savedParameters field in the project environment (used in saveasProject()).

newProjectName

The name of the project to save an open project as.

to

A string naming the parameters to reset a project to (one of "original" and "saved", where the latter is only used in saveasProject()).

subset.out

Logical: Used in is.project. If TRUE, subset the input project names, and if False, return a logical vector.

nchars

The number of characters to read when determining the types of the files in readXMLfiles().

Value

A project object createProject returns the path to the StoX project directory.

openProject returns the object specified in 'out'.

reopenProject returns the object specified in 'out'.

getProject returns the requested object (one of the project object, the baseline, object, the baseline report object, ot the project name). If the project is not open, NULL is returned.

updateProject returns TRUE for success and FALSE for no XML files linked to reading functions.

saveProject returns the project object.

closeProject returns TRUE if the project was open and FALSE if not.

isProject returns TRUE if the project exists on file and FALSE if not.

readXMLfiles returns the XML data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Show templates:
templ <- createProject()
names(templ)
str(templ)

# See avilable projects, either as full paths or as a list:
op <- openProject()
str(op)
opl <- openProject(list())
str(opl)
# A test project "Test_Rstox" is automatically created when openProject("Test_Rstox") is run. 
# If one wishes to re-create the "Test_Rstox" project, use createProject("Test_Rstox", ow=TRUE).

# Read xml file directly from any location:
xmlfiles <- system.file("extdata", "Test_Rstox", package="Rstox", "input")
list.files(xmlfiles, recursive=TRUE)
dat <- readXMLfiles(xmlfiles)

Sea2Data/Rstox documentation built on May 14, 2019, 8:58 a.m.