Learn R Programming

prioriactions (version 0.5.0)

data-class: Data class

Description

This class is used to represent data of the instances of the corresponding multi-action planning problem. It includes several methods for retrieving the information of the instance (such as the spatial allocation of threats and species, the cost of management actions or the structure of the spatial connectivity across the area where the planning is carried out. This class is created using the inputData() function.

Arguments

Value

No return value.

Fields

data

list object containing data.

Methods

getActionsAmount():

integer. Number of possible actions.

getData(character name):

data.frame(). Object stored in the data field with the corresponding name. The argument name indicates the name of arguments of the problem function ("pu", "features", "dist_features", "threats", "dist_threats", "sensitivity" or "boundary").

getFeatureAmount():

integer. Number of features.

getFeatureNames():

character. Names of features.

getMonitoringCosts():

numeric vector(). Cost of monitoring each planning unit.

getPlanningUnitsAmount():

integer. Number of planning units.

getActionCosts():

numeric vector(). Cost of actions each planning unit and threat.

getThreatNames():

character. Names of threats.

getThreatsAmount():

integer. Number of threats.

print():

Print basic information of the data instance.

show():

Call print method.

Examples

Run this code
## set seed for reproducibility
set.seed(14)

## Set prioriactions path
prioriactions_path <- system.file("extdata/example_input/", package = "prioriactions")

## Load in planning unit data
pu_data <- data.table::fread(paste0(prioriactions_path,"/pu.dat"),
                             data.table = FALSE)
head(pu_data)

## Load in feature data
features_data <- data.table::fread(paste0(prioriactions_path,"/features.dat"),
                                   data.table = FALSE)
head(features_data)

## Load in planning unit vs feature data
dist_features_data <- data.table::fread(paste0(prioriactions_path,"/dist_features.dat"),
                                        data.table = FALSE)
head(dist_features_data)

## Load in the threats data
threats_data <- data.table::fread(paste0(prioriactions_path,"/threats.dat"),
                                  data.table = FALSE)
head(threats_data)

## Load in the threats distribution data
dist_threats_data <- data.table::fread(paste0(prioriactions_path,"/dist_threats.dat"),
                                       data.table = FALSE)
head(dist_threats_data)

## Load in the sensitivity data
sensitivity_data <- data.table::fread(paste0(prioriactions_path,"/sensitivity.dat"),
                                      data.table = FALSE)
head(sensitivity_data)

## Load in the boundary data
boundary_data <- data.table::fread(paste0(prioriactions_path,"/boundary.dat"),
                                   data.table = FALSE)
head(boundary_data)

## Create instance
problem_data <- inputData(
  pu = pu_data, features = features_data, dist_features = dist_features_data,
  dist_threats = dist_threats_data, threats = threats_data, sensitivity = sensitivity_data,
  boundary = boundary_data
)

## Summary
print(problem_data)

## Use class methods
problem_data$getData("features")

problem_data$getFeatureAmount()

problem_data$getFeatureNames()

problem_data$getMonitoringCosts()

problem_data$getPlanningUnitsAmount()

problem_data$getActionCosts()

problem_data$getThreatNames()

problem_data$getThreatsAmount()

problem_data$print()

Run the code above in your browser using DataLab