This function creates a new object of class data.goldfish and populates it with the provided R objects and their linked objects, as specified by attributes common in the 'goldfish' package. This is useful for creating a self-contained data context for estimate_dynam(), estimate_rem(), estimate_dynami() and gather_model_data().

make_data(..., parent_env = parent.frame())

make_data_goldfish(..., parent_env = parent.frame())

Arguments

...

Objects to be included in the data environment. These objects will be copied by their given argument names.

parent_env

The parent environment for the new data environment. Also, the environment from which linked objects (not explicitly provided in ...) will be searched. Defaults to parent.frame().

Value

An environment of class data.goldfish containing the specified objects and their resolved dependencies.

Details

The function recursively searches for linked objects:

  • For a nodes.goldfish object: Events that modify its nodal attributes.

  • For a network.goldfish object: Events that modify its structure, and the nodes.goldfish object(s) that define its nodes.

  • For a dependent.goldfish object: The network.goldfish object and nodes.goldfish object(s) defining its events' scope.

Linked objects are searched for in the parent_env (defaults to the calling environment) and the enclosing frames of the parent_env environment (see base::get(), base::exists()).

Examples

data("Social_Evolution")
callNetwork <- make_network(nodes = actors, directed = TRUE)
callNetwork <- link_events(
  x = callNetwork, change_event = calls,
  nodes = actors
)
callsDependent <- make_dependent_events(
  events = calls, nodes = actors,
  default_network = callNetwork
)
socialEvolutionData <- make_data(
  callNetwork, callsDependent, actors
)

data("Fisheries_Treaties_6070")
states <- make_nodes(states)
states <- link_events(states, sovchanges, attribute = "present")
states <- link_events(states, regchanges, attribute = "regime")
states <- link_events(states, gdpchanges, attribute = "gdp")

bilatnet <- make_network(bilatnet, nodes = states, directed = FALSE)
bilatnet <- link_events(bilatnet, bilatchanges, nodes = states)

contignet <- make_network(contignet, nodes = states, directed = FALSE)
contignet <- link_events(contignet, contigchanges, nodes = states)

createBilat <- make_dependent_events(
  events = bilatchanges[bilatchanges$increment == 1, ],
  nodes = states, default_network = bilatnet
)

fisheriesData <- make_data(
  bilatnet, createBilat, states,
  contignet, sovchanges, regchanges, gdpchanges
)