[R] testInstalledBasic question

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 6 11:15:08 CEST 2010


The code contains

     ## We need to force C collation: might not work
     Sys.setlocale("LC_COLLATE", "C")

It seems that is not working for you.  Try setting LC_COLLATE=C in the 
environment before running the tests.

You do also need diff (from Rtools) in your path for the best results.


On Wed, 5 May 2010, Jim Price wrote:

>
> Hi,
>
> I'm currently in the process of writing an R-installation SOP for my
> company. As part of that process I'm using the recommendations from the 'R
> Installation and Administration' document, section 3.2, "Testing an
> installation". This is done on an XP machine, using the latest binary of
> 2.11.0.
>
> The binary is downloaded and then installed from the installer. I then start
> an Rgui.exe session with --vanilla enabled. At this point:
>
>
>> sessionInfo()
> R version 2.11.0 (2010-04-22)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252    LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C                           LC_TIME=English_United
> States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>
>
> Next I start testing, using the following:
>
>
> library(tools)
> testInstalledBasic(scope = 'devel')   # Just checking devel for illustrative
> purposes
>
>
> Results displayed are as follows:
>
>
> 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 messages:
> 1: In system(paste("diff -bw", shQuote(a), shQuote(b))) : diff not found
> 2: In system(paste("diff -bw", shQuote(a), shQuote(b))) : diff not found
>
>
>
> In the tests directory, in primitives.rout.fail I see the following:
>
>
>
>> ## 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
>
>
>
> A quick check in the console gives this:
>
>
>
>> ls(.GenericArgsEnv, all.names = TRUE)
> [1] "!"            "!="           "%%"           "%/%"          "&"
> "*"            "+"
> [8] "-"            "/"            "<"            "<="           "=="
> ">"            ">="
> [15] "Arg"          "Conj"         "Im"           "Mod"          "Re"
> "^"            "abs"
> [22] "acos"         "acosh"        "all"          "any"
> "as.character" "as.complex"   "as.double"
> [29] "as.integer"   "as.logical"   "as.numeric"   "as.raw"       "as.real"
> "asin"         "asinh"
> [36] "atan"         "atanh"        "c"            "ceiling"      "cos"
> "cosh"         "cummax"
> [43] "cummin"       "cumprod"      "cumsum"       "digamma"      "dim"
> "dim<-"        "dimnames"
> [50] "dimnames<-"   "exp"          "expm1"        "floor"        "gamma"
> "is.array"     "is.finite"
> [57] "is.infinite"  "is.matrix"    "is.na"        "is.nan"
> "is.numeric"   "length"       "length<-"
> [64] "levels<-"     "lgamma"       "log"          "log10"        "log1p"
> "log2"         "max"
> [71] "min"          "names"        "names<-"      "prod"         "range"
> "rep"          "round"
> [78] "seq.int"      "sign"         "signif"       "sin"          "sinh"
> "sqrt"         "sum"
> [85] "tan"          "tanh"         "trigamma"     "trunc"        "xtfrm"
> "|"
>
>
>
> Which confuses me, because the calling code in tests\\primitives.R removes
> the first 15 elements, which includes ">=" which the test is failing on.
>
>
>
> To check (and because testInstalledBasic is calling out to a separate, new R
> process), I repeated the testInstalledBasic functionality ex-function; so in
> a clean session I ran the following:
>
>
> ### Clean session ###
>
>
> Sys.setenv(LANGUAGE = "C")
> Sys.setenv(R_DEFAULT_PACKAGES = "")
> Sys.setenv(SRCDIR = ".")
>
> oldwd <- setwd(file.path(R.home(), 'tests'))
>
> source('primitives.R', echo = T)
>
> setwd(oldwd)
>
>
> # Fails with: Error in eval.with.vis(expr, envir, enclos) : failure on >=
>
>
> Now my checking gives:
>
>
>> ls(.GenericArgsEnv, all.names = TRUE)
> [1] "-"            "!"            "!="           "%%"           "%/%"
> "&"            "*"            "/"
> [9] "^"            "|"            "+"            "<"            "<="
> "=="           ">"            ">="
> [17] "abs"          "acos"         "acosh"        "all"          "any"
> "Arg"          "as.character" "as.complex"
> [25] "as.double"    "as.integer"   "as.logical"   "as.numeric"   "as.raw"
> "as.real"      "asin"         "asinh"
> [33] "atan"         "atanh"        "c"            "ceiling"      "Conj"
> "cos"          "cosh"         "cummax"
> [41] "cummin"       "cumprod"      "cumsum"       "digamma"      "dim"
> "dim<-"        "dimnames"     "dimnames<-"
> [49] "exp"          "expm1"        "floor"        "gamma"        "Im"
> "is.array"     "is.finite"    "is.infinite"
> [57] "is.matrix"    "is.na"        "is.nan"       "is.numeric"   "length"
> "length<-"     "levels<-"     "lgamma"
> [65] "log"          "log10"        "log1p"        "log2"         "max"
> "min"          "Mod"          "names"
> [73] "names<-"      "prod"         "range"        "Re"           "rep"
> "round"        "seq.int"      "sign"
> [81] "signif"       "sin"          "sinh"         "sqrt"         "sum"
> "tan"          "tanh"         "trigamma"
> [89] "trunc"        "xtfrm"
>
>
>
> Now ">=" is the 16th element of the environment, which suggests that this is
> why my testing is failing.
>
>
>
>
> Am I doing something wrong? Should the actual code in tests\\primitives.R
> be: for(f in ls(.GenericArgsEnv, all.names=TRUE)[-(1:16)]) instead of 1:15
> (or be OS dependent)?
>
>
> Any comments and help welcomed. If I'm unclear in any steps I've taken
> please feel free to correct me.
>
>
>
> Jim Price.
> Cardiome Pharma Corp.
>
>
>
>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/testInstalledBasic-question-tp2131680p2131680.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list