load-save-hugin.Rd
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 = NULL, details = 0)
saveHuginNet(gin, file, details = 0)
An object of class grain
.
In Hugin, it is possible to specify the potential of a node as a
functional relation between other nodes. In a .net file, such a
specification will appear as 'function' rather than as
'node'. Such a specification is not recognized by loadHuginNet
.
It is recommended to avoid the text node
as part of the name of
a node.
Søren Højsgaard (2012). Graphical Independence Networks with the gRain Package for R. Journal of Statistical Software, 46(10), 1-26. https://www.jstatsoft.org/v46/i10/.
## Load HUGIN net file
tf <- system.file("huginex", "chest_clinic.net", package = "gRain")
chest <- loadHuginNet(tf, details=1)
chest
#> Independence network: Compiled: TRUE Propagated: FALSE Evidence: FALSE
## Save a copy
td <- tempdir()
saveHuginNet(chest, paste(td,"/chest.net",sep=''))
## Load the copy
chest2 <- loadHuginNet(paste(td,"/chest.net",sep=''))
tf <- system.file("huginex", "golf.net", package = "gRain")
golf <- loadHuginNet(tf, details=1)
saveHuginNet(golf, paste(td,"/golf.net",sep=''))
golf2 <- loadHuginNet(paste(td,"/golf.net",sep=''))