This function simulates Weight objects.

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:       ca3302e2-25cf-487c-b571-c60d788379ae
#>   name:     Tsunami threat
#>   variable: .../sim_raster_spatial.tif#Tsunami_threat [total: 160.06 ha]
#>   pane:  6c278060-9fb0-4fa0-a7d0-1a3cee16405a-Tsunami_threat
#>   current:  0.53
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   TRUE
#>   factor:   0
#> 
#> [[2]]
#> Weight
#>   id:       5a4798e9-e33f-475f-aadc-d8b237aed73c
#>   name:     Pesticide risk
#>   variable: .../sim_raster_spatial.tif#Pesticide_risk [total: 130.71 ha]
#>   pane:  b82decef-4a16-4d72-8be0-e179f645894b-Pesticide_risk
#>   current:  0.19
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   TRUE
#>   factor:   0
#>