Re: [R-pkg-devel] visible binding for '<<-' assignment

2020-09-03 Thread William Dunlap
> Is there a reason that this slightly more explicit > version [assign(envir=.GlobalEnv)] wouldn't work? https://cran.r-project.org/web/packages/policies.html - Packages should not modify the global environment (user’s workspace). Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Sep 3, 2020

Re: [Rd] NAs and rle

2020-08-26 Thread William Dunlap via R-devel
Splus's rle() also grouped NA's (separately from NaN's): % Splus TIBCO Software Inc. Confidential Information Copyright (c) 1988-2008 TIBCO Software Inc. ALL RIGHTS RESERVED. TIBCO Spotfire S+ Version 8.1.1 for Linux 2.6.9-34.EL, 32-bit : 2008 > dput(rle(c(11,11,NA,NA,NA,NaN,14,14,14,14)))

Re: [R-pkg-devel] Formatting .Rbuildignore

2020-08-17 Thread William Dunlap
I just tried this out with R-4.0.2 on Linux and it looks like .Rbuildignore does not treat lines with '#'s as comments. E.g., % mkdir test test/inst % touch 'test/inst/#octothorp.txt' 'test/inst/normal.txt' % echo > test/DESCRIPTION 'Package: test\nVersion: 0.1\nTitle: test\nDescription: A test

Re: [Rd] lm() takes weights from formula environment

2020-08-10 Thread William Dunlap via R-devel
I assume you are concerned about this because the formula is defined in one environment and the model fitting with weights occurs in a separate function. If that is the case then the model fitting function can create a new environment, a child of the formula's environment, add the weights

Re: [R-pkg-devel] Package can't be imported with Suggests

2020-08-05 Thread William Dunlap
You might make a second package that depends only on nimble and your main package can then suggest that second package and JAGS. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Aug 5, 2020 at 3:36 PM Simon Bonner wrote: > > Hi all, > > I’m wondering if someone an offer advice on a problem

Re: [R-pkg-devel] Error in CHECK caused by dev.off()

2020-07-23 Thread William Dunlap
R-4.0 introduced a new function, tools::R_user_dir(package, which), where which is one of "data", "config", and "cache". It gives standard directory names in which to place package-and-user-specific files which you want to last longer than one R session. I suppose you will still have to ask the

[Rd] CAR0 vs. EXTPTR_PTR

2020-07-22 Thread William Dunlap via R-devel
I know that binary packages are R-version specific, but it was a bit surprising that Rcpp 1.0.5 built with R-4.0.2 cannot be loaded into R-4.0.0. % R-4.0.0 --quiet > library(Rcpp, lib="lib-4.0.2") Error: package or namespace load failed for ‘Rcpp’ in dyn.load(file, DLLpath = DLLpath, ...):

Re: [R-pkg-devel] warning: type of ‘zhpevx_’ does not match original declaration [-Wlto-type-mismatch]

2020-07-06 Thread William Dunlap
, z, [0], work, rwork, iwork, ifail, [0], strlen(cjobz), > strlen(crange), strlen(cuplo)); > > > Do you see anything wrong with the above? > > Thank you > > Best > Pierre > > > From: William Dunlap > Sent: Tuesday, 7 July

Re: [R-pkg-devel] warning: type of ‘zhpevx_’ does not match original declaration [-Wlto-type-mismatch]

2020-07-06 Thread William Dunlap
Have you tried what is recommended in https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html ? For arguments of CHARACTER type, the character length is passed as a hidden argument at the end of the argument list. For deferred-length strings, the value is passed by reference,

Re: [R-pkg-devel] check cross-references error: Non-file package-anchored link(s)

2020-07-02 Thread William Dunlap
On Linux you can use 'ltrace' to get a list of all the environment variables that R looks up. E.g., do the following in 'script' so all the output is stored in a file ('typescript') and later look around in it for the getenv calls. $ R-devel --debugger=ltrace --debugger-args="-f -e getenv" ...

[Rd] Change in lapply's missing argument passing

2020-06-26 Thread William Dunlap via R-devel
Consider the following expression, in which we pass 'i=', with no value given for the 'i' argument, to lapply. lapply("x", function(i, j) c(i=missing(i),j=missing(j), i=) >From R-2.14.0 (2011-10-31) through R-3.4.4 (2018-03-15) this evaluated to c(i=TRUE, j=FALSE). From R-3.5.0 (2018-04-23)

[Rd] mget(missingArgument)?

2020-06-22 Thread William Dunlap via R-devel
Currently, when mget() is used to get the value of a function's argument with no default value and no value in the call it returns the empty name (R_MissingArg). Is that the right thing to do or should it return 'ifnotfound' or give an error? E.g., > a <- (function(x) { y <- "y from function's

Re: [R-pkg-devel] Forward function call

2020-06-08 Thread William Dunlap
Use Call[[1]] <- quote(survival::coxph) Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jun 8, 2020 at 12:12 PM Göran Broström wrote: > Hello, > > the function 'coxreg' in my package 'eha' is often just a wrapper for > 'coxph' in survival, so I have code like > > if (cox.ph){ >

[Rd] R-devel's ...names() questions

2020-05-22 Thread William Dunlap via R-devel
Am am missing something or does the new ...names() in R-devel not work right? > a <- function(x, ...) ...names() > a(a=stop("a"), b=stop("b")) [1] "a" "" > a(stop("x"), stop("unnamed"), c=stop("c"), d=stop("d")) [1] NA "" "" > version _ platform x86_64-pc-linux-gnu arch

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-22 Thread William Dunlap via R-devel
logic is > > essenttially (in pseudo-code) > > > > collapse(paste(c("a", "b"), NULL, c("c", "d"), sep = " ", > > recycle0=TRUE), collapse = ", ", recycle0=TRUE) > > > > -> col

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-21 Thread William Dunlap via R-devel
yes, I read basically two proposals, both agreeing > that recycle0 = TRUE should only ever apply to the action of 'sep' > but not the action of 'collapse'. > > 1) Bill and Hervé (I think) propose that 'recycle0' should have >no effect whenever 'collapse = ' > > 2) Gabe pr

Re: [Rd] order function called on a data.frame?

2020-05-18 Thread William Dunlap via R-devel
do.call(order, df). -> do.call(order, unname(df)). While you are looking at order(), it would be nice if ';decreasing' could be a vector the the length of list(...) so you could ask to sort some columns in increasing order and some decreasing. I thought I put this on bugzilla eons ago, but

Re: [Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

2020-05-15 Thread William Dunlap via R-devel
I agree: paste(collapse="something", ...) should always return a single character string, regardless of the value of recycle0. This would be similar to when there are no non-NULL arguments to paste; collapse="." gives a single empty string and collapse=NULL gives a zero long character vector. >

[Rd] edit() doubles backslashes when keep.source=TRUE

2020-05-14 Thread William Dunlap via R-devel
Is it just my installation or does edit() (or fix(), etc.) in R-4.0.0 double all the backslashes when options(keep.source=TRUE)? E.g., > options(keep.source=TRUE) > f <- function(x) { cat("\t", x, "\n", sep="") } > edit(f) # exit the editor without making any changes The editor (vi or notepad)

Re: [Rd] suggestion: "." in [lsv]apply()

2020-04-16 Thread William Dunlap via R-devel
Passing in a function passes not only an argument list but also an environment from which to get free variables. Since your function doesn't pay attention to the environment you get things like the following. > wsapply(list(1,2:3), paste(., ":", deparse(s))) [[1]] [1] "1 : paste(., \":\",

Re: [Rd] detect ->

2020-04-15 Thread William Dunlap via R-devel
le "<=" is > not because it denotes less than or equal. > > Now, if I could find a way to define "=>" as a standalone operator, and > convince the R parser to bypass that error, it would solve everything. If > this is not possible, I am back to detecting "-

Re: [Rd] detect ->

2020-04-13 Thread William Dunlap via R-devel
Using => and <= instead of -> and <- would make things easier, although the precedence would be different. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Apr 13, 2020 at 1:43 AM Adrian Dușa wrote: > Thank you for your replies, this actually has little to do with the > regular R code but

Re: [R-pkg-devel] Error creating union class: object ‘.__C__compMatrix’ not found

2020-04-08 Thread William Dunlap
% R-devel --vanilla --quiet > library(Matrix) > setClassUnion("mMatrix", c("Matrix", "matrix")) Error in get(cname, envir = cwhere, inherits = FALSE) : object '.__C__compMatrix' not found Error in setClassUnion("mMatrix", c("Matrix", "matrix")) : unable to create union class: could not set

Re: [R-pkg-devel] Error creating union class: object ‘.__C__compMatrix’ not found

2020-04-08 Thread William Dunlap
openv="", inherits=TRUE Tracing get(".SigLength", envir = env) on entry x=".SigLength", envir="", topenv="", inherits=TRUE Tracing get(".SigLength", envir = env) on entry x=".SigLength", envir="", topenv="&q

Re: [Rd] is.vector could handle AsIs class better

2020-03-30 Thread William Dunlap via R-devel
The use of the term 'vector' in R comes from S, where it was used, starting in the latter part of the 1970s, to refer to the most primitive (irreducible) parts of an object. It has little to do with the mathematical or physical concept of a vector and, in my opinion, should not be used much by

Re: [Rd] Inconsistant result for normalizePath on Windows

2020-03-23 Thread William Dunlap via R-devel
Re the trailing path separator - should file.path() be changed to not produce doubled path separators when an argument has a trailing path separator? Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Mar 23, 2020 at 9:24 AM Tomas Kalibera wrote: > > Hi Jiefei, > > the change in handling

Re: [Rd] support of `substitute(...())`

2020-03-12 Thread William Dunlap via R-devel
Note that substitute(...()) and substitute(someFunc(...))[-1] give slightly different results, the former a pairlist and the latter a call. > str((function(...)substitute(...()))(stop(1),stop(2),stop(3))) Dotted pair list of 3 $ : language stop(1) $ : language stop(2) $ : language

Re: [Rd] Change 77844 breaking pkgs [Re: dimnames incoherence?]

2020-02-22 Thread William Dunlap via R-devel
tibco.com On Sat, Feb 22, 2020 at 12:44 PM Martin Maechler wrote: > >>>>> Martin Maechler > >>>>> on Sat, 22 Feb 2020 20:20:49 +0100 writes: > > >>>>> William Dunlap > >>>>> on Fri, 21 Feb 2020 14

Re: [Rd] dimnames incoherence?

2020-02-21 Thread William Dunlap via R-devel
If we change the behavior NULL--[[--assignment from `[[<-`(NULL, 1, "a" ) # gives "a" (*not* a list) to `[[<-`(NULL, 1, "a" ) # gives list("a") then we have more consistency there *and* your bug is fixed too. Of course, in other situations back-compatibility would be

Re: [Rd] dimnames incoherence?

2020-02-19 Thread William Dunlap via R-devel
How far would you like to go with the automatic creation of dimnames in nested replacement operations on arrays? It currently works nicely with [<- > a <- array(numeric(), dim=c(2,0,1)); dimnames(a)[3] <- list("One") > str(a) num[1:2, 0 , 1] - attr(*, "dimnames")=List of 3 ..$

Re: [R-pkg-devel] Question regarding R package development, how to resolve "Warning: no source files found"

2020-02-11 Thread William Dunlap
INSTALL will give that warning if you have a pkg/src directory that contains no files that look like C, C++, or Fortran files. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Feb 11, 2020 at 11:58 AM Mohsen Nabian wrote: > Greetings! > > How to resolve the following warning for my R

Re: [R-pkg-devel] r-hub status

2020-02-04 Thread William Dunlap
CRAN's check gives a warning checking Rd \usage sections ... WARNING Documented arguments not in \usage in documentation object 'Process chromR objects': ‘...’ and man/proc_chromR.Rd on github does list '...' in the \arguments section but no function listed in the \usage section uses '...'.

Re: [R-pkg-devel] error in sample(), invalid 'size' argument

2020-01-15 Thread William Dunlap
If mss$member is not a matrix you will get that error because setsiz will be NULL. > setsiz <- ncol( 33 ) > sample(1:3, setsiz) Error in sample.int(length(x), size, replace, prob) : invalid 'size' argument Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Jan 15, 2020 at 4:58 AM

Re: [Rd] tempdir() containing spaces breaks installing source packages

2019-12-13 Thread William Dunlap via R-devel
You might expand the scope of this a bit to include Windows usernames with non-ASCII characters in them. If I recall correctly, if you are logged under a Cyrillic UTF-8 name then R will not even start. We have seen this in the wild. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Dec 13,

Re: [Rd] Error in close.connection(p) : ignoring SIGPIPE signal

2019-12-06 Thread William Dunlap via R-devel
You may be running out of file descriptors because the pipe objects are not getting garbage collected often enough. Adding the line if (cnt %% 100 == 0) { cat(cnt, "\n"); gc() } to your loop lets it continue indefinitely. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Dec 6, 2019 at

Re: [Rd] class() |--> c("matrix", "arrary") [was "head.matrix ..."]

2019-11-15 Thread William Dunlap via R-devel
arrays and matrices have a numeric dims attribute, vectors don't. If statements lead to bad code. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Nov 15, 2019 at 1:19 PM Abby Spurdle wrote: > > > And indeed I think you are right on spot and this would mean > > > that indeed the implicit

Re: [Rd] calls with comment attribute

2019-11-12 Thread William Dunlap via R-devel
2019 5:01 p.m., William Dunlap via R-devel wrote: > > In general R doesn't print the "comment" attribute of an object > > > structure(1:3, comment=c("a comment", "another comment")) > > [1] 1 2 3 > > but if the object is a cal

[Rd] calls with comment attribute

2019-11-12 Thread William Dunlap via R-devel
In general R doesn't print the "comment" attribute of an object > structure(1:3, comment=c("a comment", "another comment")) [1] 1 2 3 but if the object is a call it prints it in an unusual format > structure(quote(func(arg)), comment=c("a comment", "another comment")) a comment

Re: [Rd] improving the performance of install.packages

2019-11-08 Thread William Dunlap via R-devel
Suppose update.packages("pkg") installed "pkg" if it were not already installed, in addition to its current behavior of installing "pkg" if "pkg" is installed but a newer version is available. The OP could then use update.packages() all the time instead of install.packages() the first time and

Re: [Rd] improving the performance of install.packages

2019-11-08 Thread William Dunlap via R-devel
While developing a package, I often run install.packages() on it many times in a session without updating its version number. How would your proposed change affect this workflow? Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Nov 8, 2019 at 11:56 AM Joshua Bradley wrote: > I could do

Re: [Rd] Puzzled about a new method for "[".

2019-11-04 Thread William Dunlap via R-devel
> the perils certainly are not immediately apparent to me. Here is a concrete example of a peril `[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else length(cols) == 1) { SaveAt <- lapply(x, attributes) x <- NextMethod() lX <- lapply(names(x),function(nm, x,

Re: [R-pkg-devel] Bug in checks in R-devel (was: Data docs)

2019-10-28 Thread William Dunlap
The Matrix package explicitly sets LazyData to "no" with a note saying that it is necessary. LazyData: no LazyDataNote: not possible, since we use data/*.R *and* our classes My notes on implementing install.packages() in TERR include When R's install.packages() processes *.R files in the

Re: [R-pkg-devel] Building fails with 'mypackage/DESCRIPTION' does not exist

2019-09-30 Thread William Dunlap
Will the package build if you back out the "minor changes"? If so, what were the minor changes (show diff output)? Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Sep 30, 2019 at 12:24 PM Steve Gutreuter wrote: > I have a package which will no longer build after minor changes. The >

[Rd] Should slot<-() alter its first argument?

2019-09-19 Thread William Dunlap via R-devel
We noticed that the slot<- function alters its first argument, which goes against the grain of a functional language. The similar @<- does not change its first argument. Is this intended? The timeSeries and distr package depend on this altering. > setClass("Z",

Re: [R-pkg-devel] Problems installing dependences of my package

2019-09-09 Thread William Dunlap
> And now, I have another problem because the versions are usually indicated using “>=”, for example: > forecast (>=8.7) but I need to use exactly the versión 8.7 because sometimes when packages are updated, > they lost some functions. But if I use <= or == and the package is update to versión

Re: [Rd] Error: package or namespace load failed for ‘utils

2019-09-08 Thread William Dunlap via R-devel
Also, check the settings of R_HOME and/or R_LIBS. Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Sep 8, 2019 at 9:58 AM William Dunlap wrote: > Look at section 6.1 of the R Installation and Admin manual. > > 6.1 Default packages > > The set of packages loaded on startu

Re: [Rd] Error: package or namespace load failed for ‘utils

2019-09-08 Thread William Dunlap via R-devel
Look at section 6.1 of the R Installation and Admin manual. 6.1 Default packages The set of packages loaded on startup is by default > getOption("defaultPackages") [1] "datasets" "utils" "grDevices" "graphics" "stats" "methods" (plus, of course, *base*) and this can be changed by

Re: [Rd] inconsistent handling of factor, character, and logical predictors in lm()

2019-08-31 Thread William Dunlap via R-devel
> Functions like lm() treat logical predictors as factors, *not* as numerical variables. Not quite. A factor with all elements the same causes lm() to give an error while a logical of all TRUEs or all FALSEs just omits it from the model (it gets a coefficient of NA). This is a fairly common

[Rd] New lazyload rdx key type: list(eagerKey=, lazyKeys=)

2019-08-30 Thread William Dunlap via R-devel
Prior to R-3.6.0 the keys in the lazyload key files, e.g. pkg/data/Rdata.rdx or pkg/R/pkg.rdx, seemed to all be 2-long integer vectors. Now they can be lists. The ones I have seen have two components, "eagerKey" is a 2-long integer vector and "lazyKeys" is a named list of 2-long integer vectors.

Re: [Rd] ?Syntax wrong about `?`'s precedence ?

2019-08-30 Thread William Dunlap via R-devel
Precedence is a property of the parser and has nothing to do with the semantics assigned to various symbols. Using just core R functions you can see the precedence of '?' is between those of '=' and '<-'. > # '=' has lower precedence than '?' > str(as.list(parse(text="a ? b = c")[[1]])) List of

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-15 Thread William Dunlap via R-devel
e(Name=character(), Address=character(), stringsAsFactors=FALSE)) Name Address 1 Groucho grou...@marx.com 2 ch...@marx.com 3 Harpo Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Aug 15, 2019 at 1:04 PM William Dunlap wrote: > I don't care much for regmatches and haven

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-15 Thread William Dunlap via R-devel
I don't care much for regmatches and haven't tried strextract, but I think replacing the character(0) by NA_character_ is almost always inappropriate if the match information comes from gregexpr. I think strcapture() does a pretty good job of what I think you are trying to do. Perhaps adding an

[Rd] Rf_defineVar(symbol, R_UnboundValue, environment) questions

2019-08-15 Thread William Dunlap via R-devel
While poking around the C++ code in the dplyr package I ran across the idiom Rf_defineVar(symbol, R_UnboundValue, environment) to [sort of] remove 'symbol' from 'environment' Using it makes the R-level functions objects(), exists(), and get() somewhat inconsistent and I was wondering if that

Re: [Rd] Feature request: non-dropping regmatches/strextract

2019-08-15 Thread William Dunlap via R-devel
Changing the default behavior of regmatches would break its use with gregexpr, where the number of matches per input element faries, so a zero-length character vector makes more sense than NA_character_. > x <- c("John Doe", "e e cummings", "Juan de la Madrid") > m <- gregexpr("[A-Z]", x) >

Re: [Rd] Infrequent but steady NULL-pointer caused segfault in as.POSIXlt.POSIXct (R 3.4.4)

2019-08-02 Thread William Dunlap via R-devel
If you can run things on LInux try running a few iterations of that loop under valgrind, setting gctorture(TRUE) before the loop. % R --debugger=valgrind --silent > gctorture(TRUE) > for(i in 1:5) { ... body of your loop ... } valgrind can show memory misuse that eventually will cause R to

Re: [Rd] Potential bug with data.frame replacement

2019-07-15 Thread William Dunlap via R-devel
This may be related to the size of the deparsed call in the error message that Brodie and Luke were discussing recently on R-devel (" Mitigating Stalls Caused by Call Deparse on Error"). I don't get a crash, but the error message itself doesn't show up after the deparsed call. > X <-

Re: [Rd] Calculation of e^{z^2/2} for a normal deviate z

2019-06-23 Thread William Dunlap via R-devel
include/Rmath.h declares a set of 'logspace' functions for use at the C level. I don't think there are core R functions that call them. /* Compute the log of a sum or difference from logs of terms, i.e., * * log (exp (logx) + exp (logy)) * or log (exp (logx) - exp (logy)) * * without

Re: [Rd] [R] Open a file which name contains a tilde

2019-06-11 Thread William Dunlap via R-devel
Note that R treats tildes in file names differently on Windows and Linux. On Windows, it is only replaced if it it at the beginning of the line and is followed by a forward or backward slash or end-of-line. On Linux it is replaced no matter where it is in the text and ~someUser will be replaced

Re: [R-pkg-devel] R CMD build: "Error in if (any(update))"

2019-06-10 Thread William Dunlap
You might be able to find where the error occurred by putting the following lines in ~/.Rprofile cat("~/.Rprofile: setting alternate error handler\n") options( error=quote({ dump.frames() writeLines(c("Stack trace", paste0(" ",names(last.dump})) Bill Dunlap TIBCO

Re: [R-pkg-devel] try() in R CMD check --as-cran

2019-06-07 Thread William Dunlap
as this body. --- END OF FAILURE REPORT -- Fatal error: the condition has length > 1 * checking PDF version of manual ... OK * DONE Status: 1 ERROR, 1 NOTE See ‘/tmp/bill/ppp.Rcheck/00check.log’ for details. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jun 7, 201

Re: [R-pkg-devel] try() in R CMD check --as-cran

2019-06-07 Thread William Dunlap
The length-condition-not-equal-to-one checks will cause R to shutdown even if the code in a tryCatch(). Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Jun 7, 2019 at 7:47 AM Duncan Murdoch wrote: > On 07/06/2019 9:46 a.m., J C Nash wrote: > > Should try() not stop those checks from

Re: [Rd] print.() not called when autoprinting

2019-05-21 Thread William Dunlap via R-devel
lobal environment with print methods. Maybe > it'd make sense to add getOption("autoprint") which should be set to > a user- or environment- supplied function. That function would do the > dispatch. I'd be happy to send a patch for this, if it makes sense. > > Best, > Li

Re: [Rd] print.() not called when autoprinting

2019-05-21 Thread William Dunlap via R-devel
; print.complex <- function(x, ...) "complex vector" 3.6.0> 1+2i [1] 1+2i 3.6.0> print(1+2i) [1] "complex vector" Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, May 21, 2019 at 9:31 AM Martin Maechler wrote: > >>>>> William Dunlap via R-deve

Re: [Rd] WISH: Built-in R session-specific universally unique identifier (UUID)

2019-05-20 Thread William Dunlap via R-devel
I think a machine-specific input, like the MAC address, to the UUID is essential. S+ used to make a seed for the random number generator based on the the current time and process ID. A customer complained that all machines in his cluster generated the same random number stream. The machines

[Rd] print.() not called when autoprinting

2019-05-16 Thread William Dunlap via R-devel
In R-3.6.0 autoprinting was changed so that print methods for the storage modes are not called when there is no explicit class attribute. E.g., % R-3.6.0 --vanilla --quiet > print.function <- function(x, ...) { cat("Function with argument list "); cat(sep="\n", head(deparse(args(x)), -1));

Re: [Rd] [r-devel] integrate over an infinite region produces wrong results depending on scaling

2019-04-14 Thread William Dunlap via R-devel
integrate(f, xmin, xmax) will have problems when f(x) is 0 over large parts of (xmin,xmax). It doesn't have any clues to where the non-zero regions are. It computes f(x) at 21 points at each step and if all of those are zero (or some other constant?) for a few steps, it calls it a day. If you

Re: [R-pkg-devel] CRAN review

2019-03-29 Thread William Dunlap
en/include/Eigen/src/Core/MathFunctions.h" -- # 295 "/home/R/R-3.5.2/lib64/R/site-library/RcppEigen/include/Eigen/src/Core/arch/CUDA/Half.h" return x + (y-x) * half(float(std::rand()) / float(2147483647)); # 412 "/home/R/R-3.5.2/lib64/R/site-library/RcppEigen/include/Eigen/Core&quo

Re: [R-pkg-devel] CRAN review

2019-03-29 Thread William Dunlap
/check_results_BH.html > > Max > -- > *From:* R-package-devel on behalf > of William Dunlap > *Sent:* March 29, 2019 12:05 PM > *To:* Vissarion Fisikopoulos > *Cc:* R Package Development > *Subject:* Re: [R-pkg-devel] CRAN review > > It looks like it is not boost bu

Re: [R-pkg-devel] CRAN review

2019-03-29 Thread William Dunlap
RAND_MAX); } Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Mar 29, 2019 at 8:43 AM William Dunlap wrote: > > Library lpSolveAPI uses rand() and srand() in lp_utils.c. We replace > > both functions with GetRNGstate(); PutRNGstate(); unif_rand(); from > > R’s interna

Re: [R-pkg-devel] CRAN review

2019-03-29 Thread William Dunlap
> Library lpSolveAPI uses rand() and srand() in lp_utils.c. We replace > both functions with GetRNGstate(); PutRNGstate(); unif_rand(); from > R’s internal random number generation routines as it is proposed in > `Writing R Extensions`. Moreover if you run in folder `/src`: > $ grep -r 'rand()' >

Re: [Rd] Discrepancy between is.list() and is(x, "list")

2019-03-26 Thread William Dunlap via R-devel
I think this goes back to SV4 (c. late 1990's). The is. functions are much older (c. mid 1970's) , from before any class system was in S. is() and inherits() were introduced with the S4 class system and were meant to escape from the prison made by ancient design choices. Bill Dunlap TIBCO

Re: [R-pkg-devel] How to debug CRAN errors?

2019-03-13 Thread William Dunlap
e, though, is there any way to debug the > problem? I’ll assume that making repeated uploads to CRAN is not a viable > approach it would be great if there were a Docker image of their setup > available, for example. > > On Wed, 13 Mar 2019 at 17:00, William Dunlap wrote: > >>

Re: [R-pkg-devel] How to debug CRAN errors?

2019-03-13 Thread William Dunlap
The complaint > test_check("huxtable") -- 1. Failure: Data written in appropriate format (@test-openxlsx.R#101) -- `openxlsx::saveWorkbook(wb, file = "test-xlsx.xlsx", overwrite = TRUE)` produced messages. comes from your call to testthat::expect_silent() test_that("Data written

[Rd] POSIXlt$zone and $gmtoff questions

2019-03-08 Thread William Dunlap via R-devel
I've been searching for patterns in why some POSIXlt objects have the zone and gmtoff components and some don't and why gmtoff is sometimes NA when the zone is known. Is there a pattern or is it just that the additional fields and workarounds were added in an ad hoc way? E.g., as.POSIXlt adds

Re: [Rd] as.Date(Inf) displays as 'NA' but is actually 'Inf'

2019-03-05 Thread William Dunlap via R-devel
format.Date runs into trouble long before Inf: > as.Date("2018-03-05") + c(2147466052, 2147466053) [1] "5881580-07-11" "-5877641-06-23" Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Mar 5, 2019 at 2:33 PM Gabriel Becker wrote: > Richard, > > Well others may chime in here, but from

Re: [Rd] Intermittent crashes with inset `[<-` command

2019-02-27 Thread William Dunlap via R-devel
Valgrind (without gctorture) reports memory misuse: % R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18" ... > x <- 1:20 > y <- rep(letters[1:5], length(x) / 5L) > for (i in 1:1000) { + # x[y == 'a'] <- x[y == 'b'] + x <- `[<-`(x, y == 'a', x[y == 'b']) + cat(i,

Re: [Rd] code for sum function

2019-02-20 Thread William Dunlap via R-devel
Rampal Etienne wrote: > Dear Will, > > This is exactly what I find. > My point is thus that the sum function in R is not a naive sum nor a > Kahansum (in all cases), but what algorithm is it using then? > > Cheers, Rampal > > > On Tue, Feb 19, 2019, 19:08 William

Re: [Rd] code for sum function

2019-02-19 Thread William Dunlap via R-devel
The algorithm does make a differece. You can use Kahan's summation algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) to reduce the error compared to the naive summation algorithm. E.g., in R code: naiveSum <- function(x) { s <- 0.0 for(xi in x) s <- s + xi s }

Re: [Rd] nlminb with constraints failing on some platforms

2019-02-02 Thread William Dunlap via R-devel
Microsoft R Open 3.4.2 The enhanced R distribution from Microsoft Microsoft packages Copyright (C) 2017 Microsoft Corporation Using the Intel MKL for parallel mathematical computing (using 12 cores). Default CRAN mirror snapshot taken on 2017-10-15. See: https://mran.microsoft.com/. > f <-

Re: [Rd] Runnable R packages

2019-02-01 Thread William Dunlap via R-devel
To download a package with all its dependencies and install it, use the install.packages() functions instead of 'R CMD INSTALL'. E.g., in bash: mkdir /tmp/libJunk env R_LIBS_SITE=libJunk R --quiet -e 'if (!requireNamespace("purrr",quietly=TRUE)) install.packages("purrr")' For corporate

[Rd] setClass accepts slot-mismatch between slots and prototype arguments

2019-01-10 Thread William Dunlap via R-devel
I was installing the 'diffobj' package into TERR and got an error from the call StyleSummary <- setClass("StyleSummary", slots=c(container="ANY", body="ANY", map="ANY"), prototype=list( container=function(x) sprintf("\n%s\n", paste0(x, collapse="")), body=identity,

Re: [Rd] history of objects() and ls()

2019-01-03 Thread William Dunlap via R-devel
S-PLUS took it from S, sometime in the early 1990's. The "White Book" ("Statistical Models in S", Chambers and Hastie, eds.,1992), uses objects() on p.88.. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Jan 3, 2019 at 4:47 PM Peter Dalgaard wrote: > As far as I remember, this comes

Re: [Rd] formula(model.frame(..)) is misleading

2018-12-21 Thread William Dunlap via R-devel
Emeritus > McMaster University > Hamilton, Ontario, Canada > Web: http::/socserv.mcmaster.ca/jfox > > > On Dec 21, 2018, at 2:51 AM, Martin Maechler > wrote: > > > >>>>>> William Dunlap via R-devel > >>>>>>on Thu, 20 Dec 2018 1

[Rd] formula(model.frame(..)) is misleading

2018-12-20 Thread William Dunlap via R-devel
When formula() is applied to the output of model.frame() it ignores the formula in the model.frame's 'terms' attribute: > d <- data.frame(A=log(1:6), B=LETTERS[rep(1:2,c(2,4))], C=1/(1:6), D=rep(letters[25:26],c(4,2)), Y=1:6) > m0 <- model.frame(data=d, Y ~ A:B) > formula(m0) Y ~ A + B

[Rd] order(decreasing=c(TRUE,FALSE),...)

2018-12-04 Thread William Dunlap via R-devel
The NEWS file for R-devel (as of 2018-11-28 r75702) says • order(, decreasing=c(TRUE,FALSE)) could fail in some cases. Reported from StackOverflow via Karl Nordström. However, either I don't understand the meaning of decreasing=c(TRUE,FALSE) or there are still problems. I thought

Re: [Rd] named arguments discouraged in `[.data.frame` and `[<-.data.frame`

2018-11-28 Thread William Dunlap via R-devel
They can get bitten in the last two lines of this example, where the 'x' argument is not first: > d <- data.frame(C1=c(r1=11,r2=21,r3=31), C2=c(12,22,32)) > d[1,1:2] C1 C2 r1 11 12 > `[`(d,j=1:2,i=1) C1 C2 r1 11 12 Warning message: In `[.data.frame`(d, j = 1:2, i = 1) : named arguments

Re: [R-pkg-devel] nativeRoutines error when using roxygen2 in RStudio

2018-11-07 Thread William Dunlap
After installing a new version of R the OP may have to rebuild (and retest) packages like pkgload that define functions by grabbing functions from the base package and modifying them, as in pkgload/R/namespace-env.r: onload_assign("makeNamespace", eval( modify_lang(

[Rd] unlockEnvironment()?

2018-10-10 Thread William Dunlap via R-devel
R lets one lock an environment with both an R function, base::lockEnvironment, and a C function, R_LockEnvironment, but, as far as I can tell, no corresponding function to unlock an environment. Is this omission on principle or just something that has not been done yet? I ask because several

Re: [R-pkg-devel] dependency on a bioconductor package

2018-10-05 Thread William Dunlap
It looks like affy is the culprit. > requiredByCAMERA <- tools::package_dependencies("CAMERA", recursive=TRUE)$CAMERA > directlyRequired <- tools::package_dependencies(requiredByCAMERA) > names(directlyRequired)[ vapply(directlyRequired, function(x)"BiocInstaller"%in%x, FUN.VALUE=NA) ] [1] "affy"

Re: [Rd] memory footprint of readRDS()

2018-09-18 Thread William Dunlap via R-devel
The ratio of object size to rds file size depends on the object. Some variation is due to how header information is stored in memory and in the file but I suspect most is due to how compression works (e.g., a vector of repeated values can be compressed into a smaller file than a bunch of random

Re: [Rd] ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1

2018-08-30 Thread William Dunlap via R-devel
Should the following two functions should always give the same result, except for possible differences in the 'call' component of the warning or error message?: f0 <- function(x, y) x || y f1 <- function(x, y) if (x) { TRUE } else { if (y) {TRUE } else { FALSE } } And the same for the 'and'

Re: [Rd] Where does L come from?

2018-08-27 Thread William Dunlap via R-devel
Rich Calaway pointed out that S4 came out c. 1996-97, not 1991. Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Aug 26, 2018 at 8:30 PM, William Dunlap wrote: > > the lack of a decimal place had historically not been significant > > Version 4 of S (c. 1991) and versions

Re: [Rd] Where does L come from?

2018-08-26 Thread William Dunlap via R-devel
> the lack of a decimal place had historically not been significant Version 4 of S (c. 1991) and versions of S+ based on it treated a sequence of digits without a decimal point as integer. Bill Dunlap TIBCO Software wdunlap tibco.com On Sat, Aug 25, 2018 at 4:33 PM, Duncan Murdoch wrote: >

Re: [Rd] longint

2018-08-15 Thread William Dunlap via R-devel
Note that include/S.h contains /* This is a legacy header and no longer documented. Code using it should be converted to use R.h */ ... /* is this a good idea? - conflicts with many versions of f2c.h */ # define longint int S.h was meant to be used while converting to R C code

Re: [Rd] validspamobject?

2018-08-15 Thread William Dunlap via R-devel
That was my first thought (my second was trace(.Deprecated,...)). However, the spam authors don't use .Deprecated() or warning() to tell about deprecated functions. See spam/R/deprecated.R: validspamobject <- function( ...) { #.Deprecated('validate_spam()') message("`validspamobject()`

Re: [Rd] trace in uniroot() ?

2018-08-13 Thread William Dunlap via R-devel
E YOU PAY", but I usually just satisfy myself with "Not at a > minimum/root". > > Best, JN > > On 2018-08-13 06:00 PM, William Dunlap wrote: > > I tend to avoid the the trace/verbose arguments for the various root > finders and optimizers and inste

Re: [Rd] trace in uniroot() ?

2018-08-13 Thread William Dunlap via R-devel
I tend to avoid the the trace/verbose arguments for the various root finders and optimizers and instead use the trace function or otherwise modify the function handed to the operator. You can print or plot the arguments or save them. E.g., > trace(ff, print=FALSE, quote(cat("x=", deparse(x),

Re: [Rd] apply with zero-row matrix

2018-08-13 Thread William Dunlap via R-devel
vapply has a mandatory FUN.VALUE argument which specifies the type and size of FUN's return value. This helps when you want to cover the 0-length case without 'if' statements. You can change your apply calls to vapply calls, but they will be a bit more complicated. E.g., change

Re: [Rd] odd behavior of names

2018-07-29 Thread William Dunlap via R-devel
Bugzilla issue 16101 describes another first-list-name-printed-differently oddity with the Windows GUI version of R: > a <- "One is \u043E\u0434\u0438\u043D\nTwo is \u0434\u0432\u0430\n" > Encoding(a) # expect "UTF-8" [1] "UTF-8" > sapply(strsplit(a, "\n")[[1]], charToRaw)[c(1,1,2)] $`One is

Re: [R-pkg-devel] Determine subset from glm object

2018-07-08 Thread William Dunlap
If there might be NA's in the response or predictors so na.exclude or na.omit would remove some rows as well, then using the row.names might be an easier way to match up rows in the original data with rows in gout$x. Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Jul 8, 2018 at 11:04 AM,

  1   2   3   4   5   6   >