The defineNodes() function processes and checks the data.frame passed to the nodes argument. This is a recommended step before the definition of the network.

defineNodes(nodes)

Arguments

nodes

a data.frame object with the nodes attributes with the following reserved names

label

character variable containing the nodes labels (mandatory)

present

logical variable indicating if the respective node is present at the first time-point (optional)

Value

an object with an additional class nodes.goldfish with attributes:

events

An empty character vector. linkEvents() is used to link event data frames.

dynamicAttributes

An empty character vector. linkEvents() is used to link event data frames and their related attribute.

The object can be modified using methods for data frames.

Details

Additional variables in the nodes data frame object are considered as the initial values of the nodes attributes. Those variables must be of class numeric, character, logical.

It is important that the initial definition of the node set contain all the nodes that could be potential senders or receivers of events. In case that all the nodes are not available at all times, the present variable can be used to define compositional changes. Therefore, the initial node set would contain all the potential senders and receivers nodes and the variable present will indicate all the nodes present at the beginning as senders or receivers. Using linkEvents() is possible to link events where the composition of available nodes changes over time, see vignette("teaching2").

For the attributes in the nodeset to become dynamic, them can be linked to a dynamic event-list data frames in the initial state object by using the linkEvents(). A new call of linkEvents() is required for each attribute that is dynamic.

Objects of class tibble::tbl_df from the tibble package frequently use in the tidyverse ecosystem and objects from the data.table package will produce errors in later steps for goldfish. Current implementation of goldfish relies on the subsetting behavior of data frames objects. The previous mentioned objects classes change this behavior producing errors.

Examples

nodesAttr <- data.frame(
  label = paste("Actor", 1:5),
  present = c(TRUE, FALSE, TRUE, TRUE, FALSE),
  gender = c(1, 2, 1, 1, 2)
)
nodesAttr <- defineNodes(nodes = nodesAttr)

# Social evolution nodes definition
data("Social_Evolution")
actors <- defineNodes(actors)

# Fisheries treaties nodes definition
data("Fisheries_Treaties_6070")
states <- defineNodes(states)