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.grain(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.grain(chestf2) tf <- system.file("huginex", "golf.net", package = "gRain") golff <- loadHuginNet(tf, trace=1) golf <- as.grain(golff) saveHuginNet(golf, paste(td,"/golf.net",sep='')) golff2 <- loadHuginNet(paste(td,"/golf.net",sep='')) golf2 <- as.grain(golff2)