* using log directory 'd:/Rcompile/CRANpkg/local/2.6/gRain.Rcheck' * using R version 2.6.2 (2008-02-08) * checking for file 'gRain/DESCRIPTION' ... OK * this is package 'gRain' version '0.3.3' * checking package name space information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking whether package 'gRain' can be installed ... OK * checking package directory ... OK * checking for portable file names ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the name space can be loaded with stated dependencies ... OK * checking for unstated dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking for portable use of $BLAS_LIBS ... OK * creating gRain-Ex.R ... OK * checking examples ... ERROR Running examples in 'gRain-Ex.R' failed. The error most likely occurred in: > ### * gmInstance > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: gmInstance > ### Title: Graphical Independence Network > ### Aliases: newgmInstance newgmInstance.cptspec newgmInstance.dagsh > ### newgmInstance.ugsh nodeNames nodeStates nodeNames.gmInstance > ### nodeStates.gmInstance as.gmInstance as.gmInstance.huginNet > ### Keywords: models > > ### ** Examples > > > ## Asia (chest clinique) example - using a gmData object > ## > chestNames <- c("asia", "smoke", "tub", "lung", "bronc", "either", "xray", "dysp") > gmd <- newgmData(chestNames,valueLabels=c("yes","no")) > summary(gmd) varNames shortNames varTypes nLevels asia asia a Discrete 2 smoke smoke s Discrete 2 tub tub t Discrete 2 lung lung l Discrete 2 bronc bronc b Discrete 2 either either e Discrete 2 xray xray x Discrete 2 dysp dysp d Discrete 2 To see the values of the factors use the 'valueLabels' function Factor: asia Levels: yes no Factor: smoke Levels: yes no Factor: tub Levels: yes no Factor: lung Levels: yes no Factor: bronc Levels: yes no Factor: either Levels: yes no Factor: xray Levels: yes no Factor: dysp Levels: yes no > > p.a <-cpt('asia', values=c(0.01,0.99),gmData=gmd) > p.t.a <-cpt('tub',pa='asia', values=c(0.05,0.95,0.01,0.99),gmData=gmd) > p.s <-cpt('smoke', values=c(0.5,0.5), gmData=gmd) > p.l.s <-cpt('lung',pa='smoke', values=c(0.1,0.9,0.01,0.99), gmData=gmd) > p.b.s <-cpt('bronc',pa='smoke', values=c(0.6,0.4,0.3,0.7), gmData=gmd) > p.e.lt <-cpt('either',pa=c('lung','tub'),values=c(1,0,1,0,1,0,0,1),gmData=gmd) > p.x.e <-cpt('xray',pa='either', values=c(0.98,0.02,0.05,0.95), gmData=gmd) > p.d.be <-cpt('dysp',pa=c('bronc','either'), values=c(0.9,0.1,0.7,0.3,0.8,0.2,0.1,0.9), gmData=gmd) > > cptlist <- list(p.a, p.t.a, p.s, p.l.s, p.b.s, p.e.lt, p.x.e, p.d.be) > cptlist[[1]] asia yes no 0.01 0.99 > cptlist[[2]] asia tub yes no yes 0.05 0.01 no 0.95 0.99 > > bn <- newgmInstance(cptspec(cptlist), gmd) > bn Independence network: Compiled: FALSE Propagated: FALSE > > summary(bn) Nodes : asia tub smoke lung bronc either xray dysp Compiled: FALSE Propagated: FALSE > plot(bn) > > ## Asia (chest clinique) example - without using a gmData object > ## > yn <- c("yes","no") > a <- cpt(~asia, values=c(1,99),levels=yn) > t.a <- cpt(~tub+asia, values=c(5,95,1,99),levels=yn) > s <- cpt(~smoke, values=c(5,5), levels=yn) > l.s <- cpt(~lung+smoke, values=c(1,9,1,99), levels=yn) > b.s <- cpt(~bronc+smoke, values=c(6,4,3,7), levels=yn) > e.lt <- cpt(~either+lung+tub,values=c(1,0,1,0,1,0,0,1),levels=yn) > x.e <- cpt(~xray+either, values=c(98,2,5,95), levels=yn) > d.be <- cpt(~dysp+bronc+either, values=c(9,1,7,3,8,2,1,9), levels=yn) > > plist <- cptspec(list(a, t.a, s, l.s, b.s, e.lt, x.e, d.be)) > pn <- newgmInstance(plist) > pn Independence network: Compiled: FALSE Propagated: FALSE > > summary(pn) Nodes : asia tub smoke lung bronc either xray dysp Compiled: FALSE Propagated: FALSE > plot(pn) > > ## Create network from gmData (with data) and graph specification. > ## There are different ways: > ## > data(HairEyeColor) > d <- as.gmData(HairEyeColor) > dag <- newdagsh(list(~Hair, ~Eye+Hair, ~Sex+Hair)) > class(dag) [1] "dagsh" attr(,"package") [1] "gRain" > ug <- newugsh(list(~Eye+Hair, ~Sex+Hair)) > class(ug) [1] "ugsh" attr(,"package") [1] "gRain" > > ## 1) Create directly from dag > b1 <- newgmInstance(dag,d) > class(b1) [1] "dag-gmInstance" "gmInstance" > > ## 2) Extract cpt's for dag from gmData and build network from cpt's > x<-dag2cptspec(dag,d) > class(x) [1] "cptspec" > b2 <- newgmInstance(x,d) > class(b2) [1] "cpt-gmInstance" "gmInstance" > > ## 3) Build model from undirected (decomposable) graph > b3 <- newgmInstance(ug,d) > class(b3) [1] "ug-gmInstance" "gmInstance" > > ## Simple example - one clique only in triangulated graph > ## > plist <- cptspec(list(a, t.a)) > pn <- newgmInstance(plist) > querygm(pn) Error in subsetof(cvert, x) : 4 arguments passed to .Internal(match) which requires 3 Calls: querygm ... nodeMarginal -> which -> sapply -> lapply -> FUN -> subsetof Execution halted