Skip to contents

This function simulates Weight objects.

Usage

simulate_weights(dataset, n, continuous = TRUE)

Arguments

dataset

Dataset object.

n

integer number of weights to simulate.

continuous

logical should the data be continuous? Defaults to TRUE.

Value

A list of simulated Weight objects.

See also

Examples

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

# create new dataset
d <- new_dataset(f1, f2, f3)

# simulate data
x <- simulate_weights(dataset = d, n = 2)
# print results
print(x)
#> [[1]]
#> Weight
#>   id:       6fcaafa8-4ee8-4a0e-916e-aac381de6e56
#>   name:     Transportation network
#>   variable: .../sim_raster_spatial.tif#Transportation_network [total: 151.94 ha]
#>   pane:  52dd7697-9744-47d6-9100-7b825e550171-Transportation_network
#>   current:  0.55
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   TRUE
#>   factor:   0
#> 
#> [[2]]
#> Weight
#>   id:       c79f4b2a-0b9e-4cc1-8f2c-47c499713f62
#>   name:     Habitat intactness index
#>   variable: .../sim_raster_spatial.tif#Habitat_intactness_index [total: 106.76 ha]
#>   pane:  69c25dbd-3504-4bc1-9d3d-5d127b934376-Habitat_intactness_index
#>   current:  0.34
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   TRUE
#>   factor:   0
#>