simulation_modification: Modify the particles in a simulation

Description Usage Arguments Value See Also

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

1
2
3
add_particles(.data, ..., interactions = NULL, 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 x, y, x_vel, and y_vel columns. New particle will have NA. The function must return a position and velocity for all particles even though the values for the current particles will be discarded. If NULL it will use the genesis function used when creating the simulation.

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()


thomasp85/particles documentation built on Jan. 15, 2019, 2:25 a.m.