as.parental: Convert an object to a parental object.

Description Usage Arguments See Also Examples

View source: R/convert.R

Description

A generic function for converting objects to parental objects.

Usage

1

Arguments

x

An object

...

Further arguments passed to method

See Also

as.parental.bn, as.parental.matrix, as.parental.character, as.parental.graphNEL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
x <- bn(c(), c(1), c(1, 2))
as.parental(x)

adjmat <- matrix(sample(c(0, 1), 100, rep = TRUE), 10, 10)
diag(adjmat) <- 0
as.parental(adjmat)

edgelist <- matrix(c(1, 2), nrow = 1, ncol = 2)
colnames(edgelist) <- c("row", "col")
as.parental(edgelist, type = "edgelist", n = 2)

x <- "[3][1][2][1][1,3]"
as.parental(x, pretty = TRUE)

x <- "3,1,2,1,c(1,3)"
as.parental(x)

if (require(graph)){
set.seed(123)
c1 <- c(1, 1, 2, 4)
names(c1) <- as.character(1:4)
g1 <- randomNodeGraph(c1)
as.parental(g1)
}

rjbgoudie/parental documentation built on May 27, 2019, 9:11 a.m.