Learn R Programming

bnspatial (version 0.9)

loadNetwork: Load a Bayesian network

Description

This function loads the Bayesian network from a native gRain object of class "grain" or an external file with extension .net (as provided from Hugin or GeNIe), then compiles the network if a target node of interest is given.

Usage

loadNetwork(network, target = NULL)

Arguments

network
The Bayesian network. An object of class "grain" (package gRain), or a character (the path to the ".net" file to be imported)
target
character. The node of interest to be modelled and mapped.

Value

An object of class "grain". The Bayesian network. If target argument is provided the network is compiled for a faster querying .

Details

Bayesian networks from the package "bnlearn" can be imported via the function ".net" file format as provided from Netica currently does not correspond to a valid Hugin .net file. Argument target has default set to NULL, but if provided the network will be compiled based on it for faster querying.

Examples

Run this code
## Load from external file (.net format)
raw = system.file("extdata/LandUseChange.net", package = "bnspatial")
loadNetwork(raw)

## Compile using target node
loadNetwork(raw, 'FinalLULC')

Run the code above in your browser using DataLab