Skip to contents

The function setGraph sets the name of the gGraph object linked to a gData object. It validates that the named object exists in the global environment and is a valid gGraph.

Usage

setGraph(x, graph)

# S4 method for class 'gData'
setGraph(x, graph)

Arguments

x

a valid gData object.

graph

either a character string giving the name of a gGraph object in the global environment, or a gGraph object itself.

Value

A gData object with the updated linked gGraph.

Functions

  • setGraph(gData): Method for gData objects

See also

getGraph to retrieve the linked graph. gData for the class definition.

Other accessor_methods: getColors(), getCoords(), getCosts(), getData(), getEdges(), getGraph(), getNodes(), getNodesAttr(), setColors()

Examples

myGraph <- dropCosts(rawgraph.40k)
hgdp2 <- setGraph(hgdp, "myGraph")
#> Error in setGraph(hgdp, "myGraph"): gGraph object myGraph not found in global environment.
getGraph(hgdp2)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'getGraph': object 'hgdp2' not found