Load and save Hugin net files

Share:

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

1
2
3
4
loadHuginNet(file, description = rev(unlist(strsplit(file, "/")))[1],
  details = 0)

saveHuginNet(gin, file, details = 0)

Arguments

file

Name of HUGIN net file. Convenient to give the file the extension '.net'

description

A text describing the network, defaults to file

details

Debugging information

gin

An independence network

Value

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

Author(s)

S<f8>ren H<f8>jsgaard, sorenh@math.aau.dk

References

S<f8>ren H<f8>jsgaard (2012). Graphical Independence Networks with the gRain Package for R. Journal of Statistical Software, 46(10), 1-26. http://www.jstatsoft.org/v46/i10/.

See Also

grain

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Load HUGIN net file
tf <- system.file("huginex", "chest_clinic.net", package = "gRain")
chest <- loadHuginNet(tf, details=1)
chest 

## 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=''))