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:        e68bddaa-883b-467d-a4a5-5fb88e89dd34
#>   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:        e40a612b-aaaf-4f80-8b3b-ebbe4525975a
#>   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:        0515440e-0d72-41bf-9bef-54f2e20f14fb
#>   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:        57dbc1fc-67e3-4ccb-93cd-6b811003bbb7
#>   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:        929fe408-c6fa-40f5-81a3-7c8ef36afb29
#>   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]
#>