read_project: Read project

View source: R/fct_read_project.R

read_projectR Documentation

Read project

Description

Read a project from disk.

Usage

read_project(
  path,
  spatial_path = NULL,
  attribute_path = NULL,
  boundary_path = NULL,
  mode = "project"
)

Arguments

path

character file path for the configuration file.

spatial_path

character file path for spatial data. Defaults to NULL such that the file path is determined using the argument to path.

attribute_path

character file path for attribute data. Defaults to NULL such that the file path is determined using the argument to path.

boundary_path

character file path for boundary data. Defaults to NULL such that the file path is determined using the argument to path.

mode

character mode for importing the objects. Defaults to "project" such that the mode is determined based on the contents of path. If the mode is "advanced", then goal limits and mandatory include settings are disabled.

Details

Note that the status field for themes and weights will automatically be set to FALSE if the goal/weight values are zero. This is to ensure that the application starts with a sensible combination of settings.

Value

A list containing the following elements:

name

A character value indicating the name.

dataset

A Dataset object.

themes

A list of Theme objects.

weights

A list of Weight objects.

includes

A list of Include objects.

excludes

A list of Exclude objects.

mode

A character value indicating the mode.

Examples

# find data file paths
f1 <- system.file(
  "extdata", "projects", "sim_raster", "sim_raster_data.yaml",
  package = "wheretowork"
)
f2 <- system.file(
  "extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
  package = "wheretowork"
)
f3 <- system.file(
  "extdata",  "projects", "sim_raster", "sim_raster_attribute.csv.gz",
  package = "wheretowork"
)
f4 <- system.file(
  "extdata",  "projects", "sim_raster", "sim_raster_boundary.csv.gz",
  package = "wheretowork"
)

# read project
x <- read_project(f1, f2, f3, f4)

# print project
print(x)

NCC-CNC/wheretowork documentation built on Feb. 27, 2025, 6:11 p.m.