[Quantian-general] Quantian and Java

Ben Goodrich goodrich at fas.harvard.edu
Sun Mar 19 22:13:13 UTC 2006


Hi all,

Dirk Eddelbuettel wrote:

>| More generally, can any think of a script to test that all the R 
>| packages actually load correctly?
>
>Well I am _building_ them all in the chroot so at least they build which
>typically entails running the examples in the documentation. R is pretty
>clever that way.
>
>That said, contributed unit or regression tests can only improve Quantian so
>please do consider writing and contributing some :)
>
>Thanks for the feedback. It is good to know that someone appreciates all the
>new Java goodies in Quantian ;-)
>
>Regards, Dirk
>
>  
>
OK. It seems as if most of the libraries that do not load correctly 
depend on rJava and the Java problem is under control. But there are a 
few others (and rlecuyer loads correctly but segmentation faults when 
detached), that may reflect a Quantian problem but probably reflect a 
problem with the package. I have trouble loading the following R 
packages, but I myself have never used any of them on any system:

          Depends                                             Built
JGR       "R (>= 1.9.0), rJava, JavaGD"                       "2.2.1"
JavaGD    "R (>= 1.9.0)"                                      "2.2.1"
RNetCDF   "R (>= 1.7.0)"                                      "2.2.0"
RWeka     "R (>= 1.9.0), rJava (>= 0.3-6), grid"              "2.2.1"
Rgraphviz "R (>= 2.1.0), graph"                               "2.2.0"
iWidgets  "R (>= 1.9.0), rJava"                               "2.2.1"
iplots    "R (>= 1.5.0), rJava"                               "2.2.1"
lsa       "Rstem"                                             "2.2.0"
ncvar     "R (>= 1.7), RNetCDF"                               "2.2.0"
pdmclass  "Biobase (>= 1.4.22), R (>= 1.9.0), fibroEset, mda" "2.2.0"
rJava     "R (>= 2.0.0), methods"                             "2.2.1"
rhdf5     "R (>= 1.9.0)"                                      "2.2.0"
spectrino "R (>= 2.0.0),rcom"                                 "2.2.0"

I used this R code to determine so. It is not quite automatic and 
requires restarting R a few times due to the limit on the number of 
dynamically loaded source objects. Maybe someone can improve it.

reset <- function() { # detaches the library and its dependencies, 
except for core packages
        search.path <- search()
        for(i in length(search.path):2) {
                if(!search.path[i] %in%       c("package:methods",
                                                "package:stats",
                                                "package:JGR",
                                                "package:tcltk",
                                                "package:rJava",
                                                "package:JavaGD",
                                                "package:datasets",
                                                "package:graphics",
                                                "package:grDevices",
                                                "package:utils",
                                                "package:datasets",
                                                "Autoloads",
                                                "package:base"))
                eval(parse(text = paste("base:::detach(", 
search.path[i], ")", sep = "")))
        }
}

test.libs <- function(begin = 1, end = nrow(ip), ...) { # indicates 
success / failure
        for(i in begin:end) {
                load.lib <- try(require(ip[i,1], quietly = TRUE, 
character.only = TRUE), silent = TRUE)
                if(is.logical(load.lib) && load.lib == TRUE) {
                        check[i] <<- TRUE
                        print(paste("*** ", ip[i,1], " is working ***", 
sep = ""))
                        reset()
                        mark <<- i
                        save(mark, check, reset, test.libs, file = 
"testR.RData", envir = .GlobalEnv)
                }
                else {
                        check[i] <<- FALSE
                        print(paste("*** Problem with: ", ip[i,1], " 
***", sep = ""))
                        mark <<- i
                        save(mark, check, reset, test.libs, file = 
"testR.RData", envir = .GlobalEnv)
                }
        }
}

options(mvbutils.replacements = FALSE) #mvbutils overwrites the 
library() function if TRUE
ip <- installed.packages()
check <- rep(FALSE, nrow(ip))
mark <- 1
test.libs(begin = 1, end = 100)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin = 101, end = 159) # Crashes on 160 if you don't kill popups
test.libs(begin = 160, end = 200)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=201, end = 300)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=301, end = 400)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=401, end = 500)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=501, end = 600)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=601, end = 645) # segmentation fault when detaching 646
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=647, end = 700)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=701, end = 800)
# RESTART R, load("testR.RData")
options(mvbutils.replacements = FALSE)
ip <- installed.packages()
test.libs(begin=801, end = nrow(ip))

ip[!check,-(c(1:6, 8:9))]

Ben



More information about the Quantian-general mailing list