Skip to contents

This function simulates Theme objects.

Usage

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:        3dd60344-bc34-4e98-bd0f-67ac98f8e331
#>   name:      Eurasian Blue Tit
#>   feature: 
#>     Eurasian Blue Tit habitat [status: TRUE, current: 0.17, goal: 0.61]
#>     
  variable: .../sim_raster_spatial.tif#Eurasian_Blue_Tit [total: 1717 ha]
#> 
#> [[2]]
#> Theme
#>   id:        277bea98-d1e6-4325-9737-7fb60355995e
#>   name:      Ground Cuckooshrike
#>   feature: 
#>     Ground Cuckooshrike habitat [status: TRUE, current: 0.53, goal: 0.81]
#>     
  variable: .../sim_raster_spatial.tif#Ground_Cuckooshrike [total: 10248.99 ha]
#> 
#> [[3]]
#> Theme
#>   id:        d97b9909-1d8c-46c2-afc7-84f408bd9d2b
#>   name:      Lesser Frigatebird (Trindade)
#>   feature: 
#>     Lesser Frigatebird (Trindade) habitat [status: TRUE, current: 0.43, goal: 0.84]
#>     
  variable: .../sim_raster_spatial.tif#Lesser_Frigatebird_Trindade_ [total: 317 ha]
#> 
#> [[4]]
#> Theme
#>   id:        b13784bd-3a87-4b02-b719-4c8831c94e22
#>   name:      Old World Buntings
#>   feature: 
#>     Vincent's Bunting [status: TRUE, current: 0.2, goal: 0.64]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#>     Cabanis's Bunting (Cabanis's) [status: TRUE, current: 0.16, goal: 0.81]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#>     Somali Bunting [status: TRUE, current: 0.56, goal: 0.81]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#>     Corn Bunting [status: TRUE, current: 0.55, goal: 0.6]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#>     Cinereous Bunting [status: TRUE, current: 0.56, goal: 0.82]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#>     Yellowhammer [status: TRUE, current: 0.19, goal: 0.69]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#>     White-capped Bunting [status: TRUE, current: 0.45, goal: 0.78]
#>     
  variable: .../sim_raster_spatial.tif#White_capped_Bunting [total: 1506 ha]
#> 
#> [[5]]
#> Theme
#>   id:        1c27f4dd-bd9d-42ba-a64d-636378a9bece
#>   name:      Bushshrikes and Allies
#>   feature: 
#>     Yellow-breasted Boubou [status: TRUE, current: 0.49, goal: 0.58]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Lagden's Bushshrike (Eastern) [status: TRUE, current: 0.58, goal: 0.58]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Western Boubou (Cameroon) [status: TRUE, current: 0.26, goal: 0.71]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Marsh Tchagra (Anchieta's) [status: TRUE, current: 0.58, goal: 0.63]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Black-fronted Bushshrike [status: TRUE, current: 0.31, goal: 0.82]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Green-breasted Bushshrike [status: TRUE, current: 0.39, goal: 0.69]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Lagden's Bushshrike (Lagden's) [status: TRUE, current: 0.15, goal: 0.65]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Papyrus Gonolek [status: TRUE, current: 0.41, goal: 0.65]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>     Brubru [status: TRUE, current: 0.25, goal: 0.64]
#>     
  variable: .../sim_raster_spatial.tif#Brubru [total: 336.21 ha]
#>