simulation_modification {particles} | R Documentation |
Modify the particles in a simulation
Description
The particles that are modelled in a simulation are encoded as a tbl_graph
,
giving support for the particles as well as their interactions (nodes and
edges in graph parlor). A simulation supports a subset of the tidygraph/dplyr
verbs in order to allow modification of the particles after they have been
included in the simulation. In general it is possible to add and remove
particles and interactions as well as modify the metadata associated with
them. The API follows the tidygraph API where activate()
is used to select
either particles or interactions and subsequent operations are thus related
to the last activated datatype. The simulation is automatically retrained
after modifying the state of the particles and their interactions.
Usage
add_particles(.data, ..., interactions = NULL, setup = NULL)
replace_particles(.data, particles, setup = NULL)
add_interaction(.data, ...)
Arguments
.data |
A simulation object |
... |
Parameters passed on to the main verbs in tidygraph/dplyr |
interactions |
A data.frame of interactions/edges to add along with the particles |
setup |
A function to calculate the starting conditions for the
particles. It receives all particles with the current position and
velocity encoded in the |
particles |
A |
Value
A simulation object
See Also
dplyr::mutate()
, dplyr::mutate_at()
, dplyr::mutate_all()
,
dplyr::filter()
, dplyr::slice()
, tidygraph::activate()
,
tidygraph::bind_nodes()
, tidygraph::bind_edges()