makeTaskGraph: Create a graph connecting the tasks within a script

Description Usage Arguments Value Author(s) See Also Examples

View source: R/graph.R

Description

This function create a graph connecting the high-level tasks within a script. The tasks are blocks of code that perform a step in the process. Each code block has input and output variables. These are used to define the associations between the tasks and which tasks are inputs to others and outputs that lead into others.

Usage

1
makeTaskGraph(doc, frags = readScript(doc), info = as(frags, "ScriptInfo"))

Arguments

doc

the name of the script file

frags

the code blocks in the script

info

the meta-information detailing the inputs and outputs of the different code blocks/fragments

Value

An object of class graphNEL-class.

Author(s)

Duncan Temple Lang

See Also

readScript getInputs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
 f = system.file("samples", "dual.R", package = "CodeDepends")
 g = makeTaskGraph(f)

 if(require(Rgraphviz))
   plot(g)

 f = system.file("samples", "parallel.R", package = "CodeDepends")
 g = makeTaskGraph(f)

 if(require(Rgraphviz))
   plot(g)

 f = system.file("samples", "disjoint.R", package = "CodeDepends")
 g = makeTaskGraph(f)

 if(require(Rgraphviz))
   plot(g)

## End(Not run)

Example output

Warning message:
In names(info) = nodeIds :
  class 'ScriptInfo' has no 'names' slot; assigning a names attribute will create an invalid object
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: grid
Warning message:
In names(info) = nodeIds :
  class 'ScriptInfo' has no 'names' slot; assigning a names attribute will create an invalid object
Warning message:
In names(info) = nodeIds :
  class 'ScriptInfo' has no 'names' slot; assigning a names attribute will create an invalid object

CodeDepends documentation built on May 2, 2019, 4:19 a.m.