This function creates a "RapData" object using pre-processed data.

RapData(
  pu,
  species,
  targets,
  pu.species.probabilities,
  attribute.spaces,
  boundary,
  polygons = NA,
  skipchecks = FALSE,
  .cache = new.env()
)

Arguments

pu

base::data.frame() planning unit data. Columns must be "cost" (numeric), "area" (numeric), and "status" (integer).

species

base::data.frame() with species data. Columns must be "name" (character).

targets

base::data.frame() with species data. Columns must be "species" (integer), "target" (integer), "proportion" (numeric).

pu.species.probabilities

base::data.frame() with data on the probability of species in each planning unit. Columns must be "species", (integer), "pu" (integer), and "value" (numeric).

attribute.spaces

list of AttributeSpaces() objects with the demand points and planning unit coordinates.

boundary

base::data.frame() with data on the shared boundary length of planning units. Columns must be "id1" (integer), "id2" (integer), and "boundary" (integer).

polygons

PBSmapping::PolySet() planning unit spatial data or NULL if data not available.

skipchecks

logical Skip data integrity checks? May improve speed for big data sets.

.cache

base::environment() used to cache calculations.

Value

RapData object

Note

Generally, users are not encouraged to change arguments to .cache.

See also

Examples

# load data data(cs_pus, cs_spp, cs_space) # create data for RapData object attribute.spaces <- list( AttributeSpaces(name = "geographic", list( AttributeSpace( planning.unit.points = PlanningUnitPoints( rgeos::gCentroid(cs_pus[1:10,], byid = TRUE)@coords, seq_len(10)), demand.points = make.DemandPoints( randomPoints(cs_spp[[1]], n = 10, prob = TRUE)), species = 1L))), AttributeSpaces(name = "environmental", list( AttributeSpace( planning.unit.points = PlanningUnitPoints( raster::extract(cs_space[[1]], cs_pus[1:10,], fun = mean), seq_len(10)), demand.points = make.DemandPoints( cs_space[[1]][raster::Which(!is.na(cs_space[[1]]))]), species = 1L))))
#> Registered S3 methods overwritten by 'adehabitatMA': #> method from #> print.SpatialPixelsDataFrame sp #> print.SpatialPixels sp
pu.species.probabilities <- calcSpeciesAverageInPus(cs_pus[1:10,], cs_spp[[1]]) polygons <- SpatialPolygons2PolySet(cs_pus[1:10,]) boundary <- calcBoundaryData(cs_pus[1:10,]) x <- RapData(pu = cs_pus@data[1:10,], species = data.frame(name = "test"), target = data.frame(species = 1L, target = 0:2, proportion = 0.2), pu.species.probabilities = pu.species.probabilities, attribute.spaces = attribute.spaces, polygons = polygons, boundary = boundary) # print object print(x)
#> RapData object.
#> Number of planning units: 10
#> Number of species: 1
#> Number of attribute spaces: 2