Learn R Programming

grPipe (version 0.1.0)

grPipe.node: Add or Update grPipe Nodes

Description

add a new node if it doesn't exist or update an existing one.

Usage

grPipe.node(nodes, id, id_next, text)

Arguments

nodes

data.frame

id

character

id_next

character

text

character

Value

Returns a data.frame with 3 columns (id, id_next and text) where:

  • If id and id_next already exist in the data.frame nodes, then return the data.frame nodes with the value text updated;

  • Otherwise, add a row in the data.frame nodes with the values passed (id, id_next and text) and then return the data.frame nodes.

Examples

Run this code
# NOT RUN {
nodes = grPipe.create(2,5)
nodes = grPipe.node(nodes, "A1",  "A2",  "input")
nodes = grPipe.node(nodes, "A2",  "B2",  "step 1")
nodes = grPipe.node(nodes, "B2",  "B3",  "step 2")
nodes = grPipe.node(nodes, "B3",  "B4",  "step 3")
nodes = grPipe.node(nodes, "B4",  "A4",  "step 4")
nodes = grPipe.node(nodes, "A4",  "A5",  "step 5")
nodes = grPipe.node(nodes, "A5",  NA,  "output")

# }

Run the code above in your browser using DataLab