File: graph.R

package info (click to toggle)
r-cran-lava 1.8.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,816 kB
  • sloc: sh: 13; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
##' Extract graph
##'
##' Extract or replace graph object
##'
##'
##' @aliases Graph Graph<-
##' @usage
##'
##' Graph(x, ...)
##'
##' Graph(x, ...) <- value
##'
##' @param x Model object
##' @param value New \code{graphNEL} object
##' @param \dots Additional arguments to be passed to the low level functions
##' @author Klaus K. Holst
##' @seealso \code{\link{Model}}
##' @keywords graphs models
##' @export
##' @examples
##'
##' m <- lvm(y~x)
##' Graph(m)
##'
##' @export
`Graph` <-
    function(x,...) UseMethod("Graph")

##' @export
`Graph.lvm` <-
    function(x,add=FALSE,...) {
        if ((is.null(x$graph) || length(x$graph)==0) & add) {
            m <- Model(x)
            return(plot(m,noplot=TRUE))
        }
        else return(x$graph)
    }

##' @export
`Graph.lvmfit` <- function(x,...) Graph.lvm(x,...)

##' @export
"Graph<-" <- function(x,...,value) UseMethod("Graph<-")

##' @export
"Graph<-.lvmfit" <- function(x,...,value) { x$graph <- value; return(x) }

##' @export
"Graph<-.lvm" <- function(x,...,value) { x$graph <- value; return(x) }