| loadHuginNet {gRain} | R Documentation |
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'.
loadHuginNet(file, description, trace = 0) saveHuginNet(bn, file, trace = 0)
bn |
An independence network |
file |
A HUGIN net file |
description |
A text describing the network, defaults to file |
trace |
Debugging information |
An object (a list) of class "huginNet".
Søren Højsgaard, sorenh@agrsci.dk
## 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)