GetNthNetwork {RNetica} | R Documentation |
Fetches networks according to an internal sequence list of networks
maintained inside of Netica. If the number passed is greater than the
number of currently defined networks, this function will return NULL
GetNthNetwork(n, session = getDefaultSession())
n |
A vector of integers greater than 1. |
session |
An object of class |
The primary use for this function is probably to loop through all open
networks. As this function will return NULL
when there are no
more networks, that can be used to terminate the loop.
Note that the sequence numbers can change, particularly after functions that open and close networks.
This is a wrapper for the Netica function GetNthNet_bn()
.
Starting with RNetica 0.5, the session object is a container which contains the open networks, so this function is no longer really needed.
If n
is of length 1, then a single NeticaBN
object or NULL
will be returned.
If n
is of length greater than 1, then a list of the
same length as n
is returned. Each element is a
NeticaBN
related or NULL
if the number is greater than
the number of open networks.
The Netica shared library uses a zero-based reference (i.e., the first net is 0), but this function subtracts 1 from the argument, so it uses a one-based reference system (the first net is 1).
Russell Almond
http://norsys.com/onLineAPIManual/index.html: GetNthNet_bn()
NeticaSession
,
CreateNetwork()
, GetNamedNetworks()
sess <- NeticaSession() startSession(sess) foo <- CreateNetwork("foo",sess) bar <- CreateNetwork("bar",sess) count <- 1 while (!is.null(net <- GetNthNetwork(count,sess))) { cat("Network number ",count," is ",NetworkName(net),".\n") count <- count +1 } cat("Found ",count-1," networks.\n") stopifnot(count==3L) stopSession(sess)