This function simulates Theme objects.

simulate_themes(
  dataset,
  n_single_themes,
  n_multi_themes,
  lambda = 5,
  continuous = NA
)

Arguments

dataset

Dataset object.

n_single_themes

integer number of themes with a single feature to simulate.

n_multi_themes

integer number of themes with a multiple features to simulate.

lambda

numeric lambda parameter for simulating the number of features for themes that contain multiple features. This parameter is used as a argument to rpois(n, lambda = lambda). Defaults to 5.

continuous

logical should the data be continuous? Defaults to NA. If NA, simulated themes are a mix of continuous and categorical defined by a conditional: stats::runif(1) > 0.5

Value

A list of simulated Theme 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_themes(data = d, n_single_themes = 3, n_multi_themes = 2)
# print results
print(x)
#> [[1]]
#> Theme
#>   id:        9f2d8b5e-bc44-428d-946a-12770b2cb636
#>   name:      Black-lored Babbler
#>   feature: 
#>     Black-lored Babbler habitat [status: TRUE, current: 0.24, goal: 0.65]
#>     
  variable: .../sim_raster_spatial.tif#Black_lored_Babbler [total: 29475.68 ha]
#> 
#> [[2]]
#> Theme
#>   id:        012f31f1-b784-4232-abb1-d2db701dd55b
#>   name:      Ornate Flycatcher
#>   feature: 
#>     Ornate Flycatcher habitat [status: TRUE, current: 0.41, goal: 0.61]
#>     
  variable: .../sim_raster_spatial.tif#Ornate_Flycatcher [total: 29725.37 ha]
#> 
#> [[3]]
#> Theme
#>   id:        2c9de630-409a-465b-b664-3e206c16630e
#>   name:      Slaty Bristlefront
#>   feature: 
#>     Slaty Bristlefront habitat [status: TRUE, current: 0.26, goal: 0.58]
#>     
  variable: .../sim_raster_spatial.tif#Slaty_Bristlefront [total: 344.43 ha]
#> 
#> [[4]]
#> Theme
#>   id:        b5d40bfa-1168-43ad-a962-382326009e18
#>   name:      Wattle-eyes and Batises
#>   feature: 
#>     Yellow-bellied Wattle-eye (Central African) [status: TRUE, current: 0.28, goal: 0.8]
#>     
  variable: .../sim_raster_spatial.tif#Angola_Batis [total: 354.31 ha]
#>     Cape Batis (Malawi) [status: TRUE, current: 0.48, goal: 0.68]
#>     
  variable: .../sim_raster_spatial.tif#Angola_Batis [total: 354.31 ha]
#>     Black-necked Wattle-eye [status: TRUE, current: 0.28, goal: 0.86]
#>     
  variable: .../sim_raster_spatial.tif#Angola_Batis [total: 354.31 ha]
#>     Bioko Batis [status: TRUE, current: 0.54, goal: 0.58]
#>     
  variable: .../sim_raster_spatial.tif#Angola_Batis [total: 354.31 ha]
#>     Angola Batis [status: TRUE, current: 0.36, goal: 0.83]
#>     
  variable: .../sim_raster_spatial.tif#Angola_Batis [total: 354.31 ha]
#> 
#> [[5]]
#> Theme
#>   id:        4891f716-156e-4240-b781-0ab588c7f72d
#>   name:      Starlings
#>   feature: 
#>     Rosy Starling [status: TRUE, current: 0.3, goal: 0.87]
#>     
  variable: .../sim_raster_spatial.tif#Raiatea_Starling [total: 1123 ha]
#>     White-billed Starling [status: TRUE, current: 0.52, goal: 0.81]
#>     
  variable: .../sim_raster_spatial.tif#Raiatea_Starling [total: 1123 ha]
#>     White-eyed Starling [status: TRUE, current: 0.51, goal: 0.58]
#>     
  variable: .../sim_raster_spatial.tif#Raiatea_Starling [total: 1123 ha]
#>     Raiatea Starling [status: TRUE, current: 0.15, goal: 0.84]
#>     
  variable: .../sim_raster_spatial.tif#Raiatea_Starling [total: 1123 ha]
#>