Create a new Weight object.
Usage
new_weight(
  name,
  variable,
  visible = TRUE,
  invisible = NA_real_,
  loaded = TRUE,
  hidden = FALSE,
  downloadable = TRUE,
  status = TRUE,
  current = 0,
  factor = 0,
  id = uuid::UUIDgenerate(),
  pane = paste(uuid::UUIDgenerate(), variable$index, sep = "-")
)Arguments
- name
- characterName to display.
- variable
- Variable object. 
- visible
- logicalThe initial visible value. This is used to determine if the feature is displayed (or not) or not the map. Defaults to- TRUE.
- invisible
- numericdate/time. A time stamp date given to when a loaded layer is first turned invisible. This is used to keep track of loaded invisible layers to offload once the cache threshold has been reached. Defaults to- NA_real_.
- loaded
- logicalThe initial loaded value. This is used to determine if the feature has been loaded into the DOM. Defaults to- FALSE.
- logicalThe hidden value. This is used to determine if the feature can ever be displayed. Unlike- visible, if this parameter is- FALSEthen a feature can never be viewed on the map. Defaults to- FALSE.
- downloadable
- logicalThe downloadable value. This is used to determine if the feature can be download. Set downloadable to- FALSEfor sensitive layers that should not be avaiable for download. Defaults to- TRUE.
- status
- logicalThe initial status value. This is used to display information on whether the feature is selected (or not) for subsequent analysis. Defaults to- TRUE.
- current
- numericcurrent proportion of values held in existing conservation areas (e.g. 0.1 = 10%).
- factor
- numericinitial factor value. Defaults to 0.
- id
- characterunique identifier. Defaults to a random identifier (- uuid::UUIDgenerate()).
- pane
- characterunique map pane identifier. Defaults to a random identifier (- uuid::UUIDgenerate()) concatenated with layer index.
Value
A Weight object.
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)
# create new variable
v <- new_variable_from_auto(d, index = 1)
# create a new weight
w <- new_weight(name = "NDVI", variable = v)
# print object
print(w)
#> Weight
#>   id:       4ed93723-d03e-4fd0-964c-702de8c0e917
#>   name:     NDVI
#>   variable: .../sim_raster_spatial.tif#Brown_necked_Parrot_Brown_necked_ [total: 483 ]
#>   pane:  96cde757-7af6-44d0-8ac9-7af8939ff569-Brown_necked_Parrot_Brown_necked_
#>   current:  0
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   TRUE
#>   factor:   0