is.GNARnet: Functions to check and create GNARnet objects

Description Usage Arguments Details Value Examples

View source: R/is.GNARnet.R

Description

is.GNARnet returns either TRUE or FALSE according to a series of GNARnet checks. as.GNARnet returns a GNARnet object from an input weights matrix, 'igraph' object, or a GNARnet without assigned class.

Usage

1
2

Arguments

x

the network to be tested or object to be converted

Details

The is.GNARnet function checks whether the network passes a series of tests:

The as.GNARnet function converts igraph objects to GNARnet form, other possible inputs are adjacency matrices, and lists with $edges and $dist entries of the correct form.

Value

is.GNARnet returns TRUE or FALSE corresponding to passing the above tests. as.GNARnet returns a GNARnet object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#check that the example network meets the criteria above
is.GNARnet(fiveNet)

#convert to igraph and back again
as.GNARnet(GNARtoigraph(fiveNet))

#generate a new network with three nodes
#edges 1->2, 2->1, 2->3
#dist 1, 2, 1
#note 1->2 and 2->1 are of different lengths
threeEdge <- list(c(2), c(1,3), NULL)
threeDist <- list(c(1), c(2,1), NULL)
threeNet <- list(edges=threeEdge, dist=threeDist)
#check if this is a GNARnet
is.GNARnet(threeNet)
#use as.GNARnet to change the class
threeNet <- as.GNARnet(threeNet)
#check if this is a GNARnet now
is.GNARnet(threeNet)

nunesmatt/GNAR documentation built on Oct. 29, 2019, 4:25 p.m.