Learn R Programming

gRain (version 0.3.0)

loadHuginNet: Load and save Hugin net files

Description

These functions can load a net file saved in the 'Hugin format' into R and save a network in R as a file in the 'Hugin format'.

Usage

loadHuginNet(file, description, trace = 0)
saveHuginNet(bn, file, trace = 0)

Arguments

bn
An independence network
file
A HUGIN net file
description
A text describing the network, defaults to file
trace
Debugging information

Value

  • An object (a list) of class "huginNet".

See Also

newgmInstance

Examples

Run this code
## Load HUGIN net file
tf <- system.file("huginex", "chest_clinic.net", package = "gRain")
chestf <- loadHuginNet(tf, trace=1)
chest <- as.gmInstance(chestf)

## Save a copy
td <- tempdir()
saveHuginNet(chest, paste(td,"/chest.net",sep=''))

## Load the copy
chestf2 <- loadHuginNet(paste(td,"/chest.net",sep=''))
chest2  <- as.gmInstance(chestf2)

tf <- system.file("huginex", "golf.net", package = "gRain")
golff <- loadHuginNet(tf, trace=1)
golf <- as.gmInstance(golff)

saveHuginNet(golf, paste(td,"/golf.net",sep=''))
golff2 <- loadHuginNet(paste(td,"/golf.net",sep=''))
golf2  <- as.gmInstance(golff2)

Run the code above in your browser using DataLab