## Not run:
# # load data
# data(cs_pus, cs_spp, cs_space)
# # create data for RapData object
# attribute.spaces <- list(
# AttributeSpaces(
# list(
# AttributeSpace(
# planning.unit.points=PlanningUnitPoints(
# rgeos::gCentroid(cs_pus[1:10,], byid=TRUE)@coords,
# seq_len(10)
# )
# demand.points=make.DemandPoints(
# SpatialPoints(
# coords=randomPoints(
# cs_spp,
# n=10,
# prob=TRUE
# )
# ),
# ),
# species=1L
# ),
# AttributeSpace(
# planning.unit.points=PlanningUnitPoints(
# extract(cs_space[[1]],cs_pus[1:10,],fun=mean),
# seq_len(10)
# ),
# demand.points=make.DemandPoints(
# SpatialPoints(
# coords=randomPoints(
# cs_spp,
# n=10,
# prob=TRUE
# )
# ),
# cs_space[[1]]
# ),
# species=1L
# )
# )
# )
# )
# pu.species.probabilities <- calcSpeciesAverageInPus(cs_pus[1:10,], cs_spp)
# 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=1, target=0:2, proportion=0.2),
# pu.species.probabilities=pu.species.probabilities,
# attribute.spaces=attribute.spaces,
# polygons=polygons,
# boundary=boundary
# )
# print(x)
# ## End(Not run)
Run the code above in your browser using DataLab