nl_default_mapping R Documentation

Default mapping from R names to NetLogo variables

Description

Creates mapping with simple rule: changes every character _. to ? and _ to -.

Usage

nl_default_mapping(param_values)

Arguments

param_values

Parameter values in list or data frame

Value

Named vector with default mapping. Use as function argument in nl_experiment mapping.

Examples

param_values = list(
  world_size = 50,
  population = 80,
  max_align_turn = c(1, 5, 20),
  max_cohere_turn = c(1, 3, 20),
  max_separate_turn = c(1, 1.5, 20),
  vision = c(1, 3, 10),
  minimum_separation = c(1, 3, 10),
  .dummy = c(1:0)
)

nl_default_mapping(param_values)

# Define experiment mapping with a function instead of named vector:
experiment <- nl_experiment(
  model_file = "models/Sample Models/Biology/Flocking.nlogo",

  param_values = list(
    world_size = 50,
    population = 80,
    max_align_turn = c(1, 5, 20),
    max_cohere_turn = c(1, 3, 20),
    max_separate_turn = c(1, 1.5, 20),
    vision = c(1, 3, 10),
    minimum_separation = c(1, 3, 10),
    .dummy = c(1:0)
  ),
  mapping = nl_default_mapping
)

# check experiment parameter names mapping
cbind(experiment$mapping)