[R] Error in testInstalledBasic

Cody Hamilton cody.shawn at yahoo.com
Wed Jun 29 19:32:27 CEST 2011


Hi,

I am running R 2.13.0 on a Windows 7 machine.

I ran the script:

testInstalledBasic('devel')

and received the following warning message:

running tests of consistency of as/is.*
creating ‘isas-tests.R’
  running code in ‘isas-tests.R’
  comparing ‘isas-tests.Rout’ to ‘isas-tests.Rout.save’ ...running tests of random deviate generation -- fails occasionally
  running code in ‘p-r-random-tests.R’
  comparing ‘p-r-random-tests.Rout’ to ‘p-r-random-tests.Rout.save’ ...running tests of primitives
  running code in ‘primitives.R’
FAILED
Warning message:
running command '"C:/PROGRA~1/R/R-213~1.0/bin/i386/R" CMD BATCH --vanilla --no-timing "primitives.R" "primitives.Rout"' had status 1 



I checked the primitives.Rout.fail file, which contains the following text:

R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ## check that the 'internal generics' are indeed generic.
> 
> x <- structure(pi, class="testit")
> xx <- structure("OK", class="testOK")
> 
> for(f in ls(.GenericArgsEnv, all.names=TRUE))
+ {
+     cat("testing S3 generic '", f, "'\n", sep="")
+     method <- paste(f, "testit", sep=".")
+     if(f %in% "seq.int") {
+         ## note that this dispatches on 'seq'.
+         assign("seq.testit", function(...) xx, .GlobalEnv)
+         res <- seq.int(x, x)
+     } else {
+         if(length(grep("<-$", f)) > 0) {
+             assign(method, function(x, value) xx, .GlobalEnv)
+             y <- x
+             res <- eval(substitute(ff(y, value=pi), list(ff=as.name(f))))
+         } else {
+             ff <- get(f, .GenericArgsEnv)
+             body(ff) <- xx
+             assign(method, ff, .GlobalEnv)
+             res <- eval(substitute(ff(x), list(ff=as.name(f))))
+         }
+     }
+     stopifnot(res == xx)
+     rm(method)
+ }
testing S3 generic '-'
testing S3 generic '!'
testing S3 generic '!='
testing S3 generic '%%'
testing S3 generic '%/%'
testing S3 generic '&'
testing S3 generic '*'
testing S3 generic '/'
testing S3 generic '^'
testing S3 generic '|'
testing S3 generic '+'
testing S3 generic '<'
testing S3 generic '<='
testing S3 generic '=='
testing S3 generic '>'
testing S3 generic '>='
testing S3 generic 'abs'
testing S3 generic 'acos'
testing S3 generic 'acosh'
testing S3 generic 'all'
testing S3 generic 'any'
testing S3 generic 'Arg'
testing S3 generic 'as.character'
testing S3 generic 'as.complex'
testing S3 generic 'as.double'
testing S3 generic 'as.environment'
testing S3 generic 'as.integer'
testing S3 generic 'as.logical'
testing S3 generic 'as.numeric'
testing S3 generic 'as.raw'
testing S3 generic 'as.real'
testing S3 generic 'asin'
testing S3 generic 'asinh'
testing S3 generic 'atan'
testing S3 generic 'atanh'
testing S3 generic 'c'
testing S3 generic 'ceiling'
testing S3 generic 'Conj'
testing S3 generic 'cos'
testing S3 generic 'cosh'
testing S3 generic 'cummax'
testing S3 generic 'cummin'
testing S3 generic 'cumprod'
testing S3 generic 'cumsum'
testing S3 generic 'digamma'
testing S3 generic 'dim'
testing S3 generic 'dim<-'
testing S3 generic 'dimnames'
testing S3 generic 'dimnames<-'
testing S3 generic 'exp'
testing S3 generic 'expm1'
testing S3 generic 'floor'
testing S3 generic 'gamma'
testing S3 generic 'Im'
testing S3 generic 'is.array'
testing S3 generic 'is.finite'
testing S3 generic 'is.infinite'
testing S3 generic 'is.matrix'
testing S3 generic 'is.na'
testing S3 generic 'is.nan'
testing S3 generic 'is.numeric'
testing S3 generic 'length'
testing S3 generic 'length<-'
testing S3 generic 'levels<-'
testing S3 generic 'lgamma'
testing S3 generic 'log'
testing S3 generic 'log10'
testing S3 generic 'log1p'
testing S3 generic 'log2'
testing S3 generic 'max'
testing S3 generic 'min'
testing S3 generic 'Mod'
testing S3 generic 'names'
testing S3 generic 'names<-'
testing S3 generic 'prod'
testing S3 generic 'range'
testing S3 generic 'Re'
testing S3 generic 'rep'
testing S3 generic 'round'
testing S3 generic 'seq.int'
testing S3 generic 'sign'
testing S3 generic 'signif'
testing S3 generic 'sin'
testing S3 generic 'sinh'
testing S3 generic 'sqrt'
testing S3 generic 'sum'
testing S3 generic 'tan'
testing S3 generic 'tanh'
testing S3 generic 'trigamma'
testing S3 generic 'trunc'
testing S3 generic 'xtfrm'
> 
> ## and that no others are generic
> for(f in ls(.ArgsEnv, all.names=TRUE))
+ {
+     if(f == "browser") next
+     cat("testing non-generic '", f, "'\n", sep="")
+     method <- paste(f, "testit", sep=".")
+     fx <- get(f, envir=.ArgsEnv)
+     body(fx) <- quote(return(42))
+     assign(method, fx, .GlobalEnv)
+     na <- length(formals(fx))
+     res <- NULL
+     if(na == 1)
+         res <- try(eval(substitute(ff(x), list(ff=as.name(f)))), silent = TRUE)
+     else if(na == 2)
+         res <- try(eval(substitute(ff(x, x), list(ff=as.name(f)))), silent = TRUE)
+     if(!inherits(res, "try-error") && identical(res, 42)) stop("is generic")
+     rm(method)
+ }
testing non-generic '%*%'
testing non-generic '.C'
testing non-generic '.cache_class'
testing non-generic '.Call'
testing non-generic '.Call.graphics'
testing non-generic '.External'
testing non-generic '.External.graphics'
testing non-generic '.Fortran'
testing non-generic '.Internal'
testing non-generic '.Primitive'
testing non-generic '.primTrace'
testing non-generic '.primUntrace'
testing non-generic '.subset'
testing non-generic '.subset2'
testing non-generic 'as.call'
testing non-generic 'attr'
testing non-generic 'attr<-'
testing non-generic 'attributes'
testing non-generic 'attributes<-'
testing non-generic 'baseenv'
testing non-generic 'call'
testing non-generic 'class'
testing non-generic 'class<-'
testing non-generic 'emptyenv'
testing non-generic 'enc2native'
testing non-generic 'enc2utf8'
testing non-generic 'environment<-'
testing non-generic 'expression'
testing non-generic 'gc.time'
testing non-generic 'globalenv'
testing non-generic 'interactive'
testing non-generic 'invisible'
testing non-generic 'is.atomic'
testing non-generic 'is.call'
testing non-generic 'is.character'
testing non-generic 'is.complex'
testing non-generic 'is.double'
testing non-generic 'is.environment'
testing non-generic 'is.expression'
testing non-generic 'is.function'
testing non-generic 'is.integer'
testing non-generic 'is.language'
testing non-generic 'is.list'
testing non-generic 'is.logical'
testing non-generic 'is.name'
testing non-generic 'is.null'
testing non-generic 'is.object'
testing non-generic 'is.pairlist'
testing non-generic 'is.raw'
testing non-generic 'is.real'
testing non-generic 'is.recursive'
testing non-generic 'is.single'
testing non-generic 'is.symbol'
testing non-generic 'lazyLoadDBfetch'
testing non-generic 'list'
testing non-generic 'missing'
testing non-generic 'nargs'
testing non-generic 'nzchar'
testing non-generic 'oldClass'
testing non-generic 'oldClass<-'
testing non-generic 'on.exit'
testing non-generic 'pos.to.env'
testing non-generic 'proc.time'
testing non-generic 'quote'
testing non-generic 'retracemem'
testing non-generic 'seq_along'
testing non-generic 'seq_len'
testing non-generic 'standardGeneric'
testing non-generic 'storage.mode<-'
testing non-generic 'substitute'
testing non-generic 'switch'
testing non-generic 'tracemem'
testing non-generic 'unclass'
tracemem[0x01b4fdd0 -> 0x03a3a6b8]: eval eval doTryCatch tryCatchOne tryCatchList tryCatch try 
testing non-generic 'untracemem'
testing non-generic 'UseMethod'
> 
> 
> ## check that all primitives are accounted for in .[Generic]ArgsEnv.
> ## and nothing else
> ff <- ls("package:base", all.names=TRUE)
> ff <- ff[sapply(ff, function(x) is.primitive(get(x, "package:base")))]
> lang_elements <-
+     c('$', '$<-', '&&', '(', ':', '<-', '<<-', '=', '@',
+       '[', '[<-', '[[', '[[<-', 'break', 'for', 'function', 'if', 'next',
+       'repeat', 'return', 'while', '{', '||', '~')
> 
> known <- c(ls(.GenericArgsEnv, all.names=TRUE),
+            ls(.ArgsEnv, all.names=TRUE),
+            lang_elements)
> stopifnot(ff %in% known, known %in% ff)
> 
> 
> ## check which are not considered as possibles for S4 generic
> ff4 <- names(methods:::.BasicFunsList)
> # as.double and as.real are the same as as.numeric
> S4generic <- ff %in% c(ff4, "as.double", "as.real")
> notS4 <- ff[!S4generic]
> if(length(notS4))
+     cat("primitives not covered in methods:::.BasicFunsList:",
+         paste(sQuote(notS4), collapse=", "), "\n")
> stopifnot(S4generic)
> 
> # functions which are listed but not primitive
> extraS4 <- c('all', 'any', 'max', 'min', 'prod', 'range',
+              'round', 'signif', 'sum')
> ff4[!ff4 %in% c(ff, extraS4)]
character(0)
> stopifnot(ff4 %in% c(ff, extraS4))
> 
> 
> ## primitives which are not internally generic cannot have S4 methods
> ## unless specifically arranged (e.g. %*%)
> nongen_prims <- ff[!ff %in% ls(.GenericArgsEnv, all.names=TRUE)]
> ff3 <- names(methods:::.BasicFunsList)[sapply(methods:::.BasicFunsList, function(x) is.logical(x) && !x)]
> ex <- nongen_prims[!nongen_prims %in% c("$", "$<-", "[", "[[" ,"[[<-", "[<-", "%*%", ff3)]
> if(length(ex))
+     cat("non-generic primitives not excluded in methods:::.BasicFunsList:",
+         paste(sQuote(ex), collapse=", "), "\n")
> stopifnot(length(ex) == 0)
> 
> ## Now check that (most of) those which are listed really are generic.
> require(methods)
> setClass("foo", representation(x="numeric", y="numeric"))
[1] "foo"
> xx <- new("foo",  x=1, y=2)
> S4gen <- names(methods:::.BasicFunsList)[sapply(methods:::.BasicFunsList, function(x) is.function(x))]
> for(f in S4gen) {
+     g <- get(f)
+     if(is.primitive(g)) g <- getGeneric(f) # should error on non-Generics.
+     ff <- args(g)
+     body(ff) <- "testit"
+     nm <- names(formals(ff))
+     ## the Summary group gives problems
+     if(nm[1] == '...') {
+         cat("skipping '", f, "'\n", sep="")
+         next
+     }
+     cat("testing '", f, "'\n", sep="")
+     setMethod(f, "foo", ff)
+     ## might have created a generic, so redo 'get'
+     stopifnot(identical(getGeneric(f)(xx), "testit"))
+ }
testing '$'
testing '$<-'
testing '['
testing '[<-'
testing '[['
testing '[[<-'
testing '%*%'
testing 'xtfrm'
testing 'c'
testing 'all'
testing 'any'
testing 'sum'
testing 'prod'
testing 'max'
testing 'min'
testing 'range'
testing '!'
testing '!='
testing '%%'
testing '%/%'
testing '&'
testing '*'
testing '+'
testing '-'
testing '/'
testing '<'
testing '<='
testing '=='
testing '>'
testing '>='
testing 'Arg'
testing 'Conj'
testing 'Im'
testing 'Mod'
testing 'Re'
testing '^'
testing 'abs'
testing 'acos'
testing 'acosh'
testing 'as.character'
testing 'as.complex'
testing 'as.double'
testing 'as.environment'
testing 'as.integer'
testing 'as.logical'
testing 'as.numeric'
testing 'as.raw'
testing 'as.real'
testing 'asin'
testing 'asinh'
testing 'atan'
testing 'atanh'
testing 'ceiling'
testing 'cos'
testing 'cosh'
testing 'cummax'
testing 'cummin'
testing 'cumprod'
testing 'cumsum'
testing 'digamma'
testing 'dim'
testing 'dim<-'
testing 'dimnames'
testing 'dimnames<-'
testing 'exp'
testing 'expm1'
testing 'floor'
testing 'gamma'
testing 'is.array'
testing 'is.finite'
testing 'is.infinite'
testing 'is.matrix'
testing 'is.na'
testing 'is.nan'
testing 'is.numeric'
testing 'length'
testing 'length<-'
testing 'levels<-'
testing 'lgamma'
testing 'log'
testing 'log10'
testing 'log1p'
testing 'log2'
testing 'names'
testing 'names<-'
testing 'rep'
testing 'round'
testing 'seq.int'
testing 'sign'
testing 'signif'
testing 'sin'
testing 'sinh'
testing 'sqrt'
testing 'tan'
testing 'tanh'
testing 'trigamma'
testing 'trunc'
testing '|'
> 
> ## check that they do argument matching, or at least check names
> except <- c("call", "switch", ".C", ".Fortran", ".Call", ".External",
+             ".Call.graphics", ".External.graphics", ".subset", ".subset2",
+             ".primTrace", ".primUntrace", "lazyLoadDBfetch",
+             ".Internal", ".Primitive", "^", "|", "%*%", "rep", "seq.int",
+             ## these may not be enabled
+             "tracemem", "retracemem", "untracemem")
> 
> for(f in ls(.GenericArgsEnv, all.names=TRUE)[-(1:15)])
+ {
+     if (f %in% except) next
+     g <- get(f, envir = .GenericArgsEnv)
+     an <- names(formals(args(g)))
+     if(length(an) >0 && an[1] == "...") next
+     an <- an[an != "..."]
+     a <- rep(list(NULL), length(an))
+     names(a) <- c("zZ", an[-1])
+     res <- try(do.call(f, a), silent = TRUE)
+     m <- geterrmessage()
+     if(!grepl('does not match|unused argument', m))
+         stop("failure on ", f)
+ }
Error: failure on >=
Execution halted


Is there something wrong with my install?

Regards,
   -Cody



More information about the R-help mailing list