[Rd] S4 methods with default argument of NULL

2021-11-06 Thread Benjamin Tyner
Greetings, I noticed that starting with R version 3.5.0, it is now possible to do, for example: setGeneric(name = "foo",    def = function(x, y, ...) standardGeneric("foo"),    valueClass = "fooResult"    ) setMethod(f = "foo",  

[Rd] failed check in reg-tests-1b.R

2020-05-19 Thread Benjamin Tyner
Not certain this is actually a bug, so posting here. I'm on Ubuntu 18.04.4 LTS, building R version 4.0.0. The "configure" and "make" steps are successful, but the "make check" step fails when it gets to this part of ./tests/reg-tests-1b.R:    > ## methods() gave two wrong warnings in some

[R-pkg-devel] use of getNativeSymbolInfo

2020-02-09 Thread Benjamin Tyner
Hello, Using package nlme as an example, where there is a registered routine fit_gnls: > library(nlme) > getDLLRegisteredRoutines("nlme")$.C$fit_gnls $name [1] "fit_gnls" $address attr(,"class") [1] "RegisteredNativeSymbol" $dll DLL name: nlme Filename:

Re: [Rd] [External] Re: rpois(9, 1e10)

2020-01-23 Thread Benjamin Tyner
On 1/20/20 12:33 PM, Martin Maechler wrote: It's really something that should be discussed (possibly not here, .. but then I've started it here ...). The NEWS for R 3.0.0 contain (in NEW FEATURES) : * Functions rbinom(), rgeom(), rhyper(), rpois(), rnbinom(), rsignrank() and

Re: [Rd] [External] Re: rpois(9, 1e10)

2020-01-20 Thread Benjamin Tyner
On 1/20/20 4:26 AM, Martin Maechler wrote: Coming late here -- after enjoying a proper weekend ;-) -- I have been agreeing (with Spencer, IIUC) on this for a long time (~ 3 yrs, or more?), namely that I've come to see it as a "design bug" that rpois() {and similar} must return return typeof()

Re: [Rd] rpois(9, 1e10)

2020-01-19 Thread Benjamin Tyner
Adler wrote: Maybe there should be code for 64 bit R to use long long or the like? On Sun, Jan 19, 2020 at 10:45 AM Spencer Graves mailto:spencer.gra...@prodsyse.com>> wrote: On 2020-01-19 09:34, Benjamin Tyner

Re: [Rd] rpois(9, 1e10)

2020-01-19 Thread Benjamin Tyner
Hello, All:   Consider: Browse[2]> set.seed(1) Browse[2]> rpois(9, 1e10) NAs produced[1] NA NA NA NA NA NA NA NA NA   Should this happen?   I think that for, say, lambda>1e6, rpois should return

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

2019-12-06 Thread Benjamin Tyner
is redirected to /dev/null. Try p <- pipe("cat > /dev/null", open = "w") instead. Regards, Andreas 2019-12-06 02:46 GMT+01:00 Benjamin Tyner: Not sure if this is a bug, so posting here first. If I run:    cnt <- 0L    while (TRUE) {        cnt <- cnt + 1L

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

2019-12-05 Thread Benjamin Tyner
Not sure if this is a bug, so posting here first. If I run:    cnt <- 0L    while (TRUE) {        cnt <- cnt + 1L        p <- pipe("echo /dev/stdin > /dev/null", open = "w")        writeLines("foobar", p)        tryCatch(close(p), error = function(e) { print(cnt); stop(e)})    } then once cnt

Re: [Rd] BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"

2019-11-25 Thread Benjamin Tyner
For what it's worth, the current behavior seems to have begun starting with version 3.6.0. If I run in version 3.5.3: > p1 <- .Primitive('+') ; p2 <- p1 ; attr(p1, "myattr") <- 1 ; p2 function (e1, e2)  .Primitive("+") On 11/18/19 10:45 AM, Martin Maechler wrote: >>/Tomas Kalibera

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

2019-09-20 Thread Benjamin Tyner
It appears this started with R version 3.5.0. Under R 3.4.4 we have: > setClass("Z", rep=representation(x="character")) > z <- new("Z", x="orig") > `@<-`(z, "x", value="newer") An object of class "Z" Slot "x": [1] "newer" > z An object of class "Z" Slot "x": [1] "newer" > `slot<-`(z, "x",

Re: [Rd] R-devel (rev 76409) fails 'make check': non-generic function 'isSymmetric' given to findMethods()

2019-04-23 Thread Benjamin Tyner
Looks fixed as of revision 76417; thanks Brian! On 4/21/19 9:02 PM, Benjamin Tyner wrote: Duncan that does indeed look to be the case. Many thanks! In particular, tests/reg-tests-1d.R optionally loads the Matrix namespace which allows the test to succeed. Compare:    ~/R-rc_2019-04

Re: [Rd] R-devel (rev 76409) fails 'make check': non-generic function 'isSymmetric' given to findMethods()

2019-04-21 Thread Benjamin Tyner
Duncan that does indeed look to be the case. Many thanks! In particular, tests/reg-tests-1d.R optionally loads the Matrix namespace which allows the test to succeed. Compare: ~/R-rc_2019-04-21_r76409/bin/Rscript -e "options(warn=2); library(Matrix); res <- findMethods('isSymmetric');

[Rd] R-devel (rev 76409) fails 'make check': non-generic function 'isSymmetric' given to findMethods()

2019-04-21 Thread Benjamin Tyner
Hello, Most likely I'm doing something wrong, but am at a loss as to what the issue is. I have a clean checkout of trunk here:    ~/svn/r-devel/R$ svn info    Path: .    Working Copy Root Path: /home/btyner/svn/r-devel/R    URL: https://svn.r-project.org/R/trunk    Relative URL: ^/trunk   

Re: [Rd] longint

2018-08-15 Thread Benjamin Tyner
/2018 7:08 AM, Benjamin Tyner wrote: Hi In my R package, imagine I have a C function defined: void myfunc(int *x) {     // some code } but when I call it, I pass it a pointer to a longint instead of a pointer to an int. Could this practice potentially result in a segfault? I don't think

[Rd] longint

2018-08-15 Thread Benjamin Tyner
Hi In my R package, imagine I have a C function defined:    void myfunc(int *x) {   // some code    } but when I call it, I pass it a pointer to a longint instead of a pointer to an int. Could this practice potentially result in a segfault? Regards Ben

Re: [Rd] Library lib.loc Option Ignored for Dependencies

2018-07-25 Thread Benjamin Tyner
On 07/25/2018 04:28 AM, Uwe Ligges wrote: Not sure if this is a bug: where is it documented that this works not as above (which is what I would expect)? The documentation doesn't say one way or the other. But the fact remains that base:::.getRequiredPackages2, when provided a non-null

Re: [Rd] Library lib.loc Option Ignored for Dependencies

2018-07-24 Thread Benjamin Tyner
On 07/24/2018 07:50 AM, Martin Maechler wrote: Benjamin Tyner on Sat, 21 Jul 2018 13:42:43 -0400 writes: > Not sure whether it is the same issue as was raised here: > https://stat.ethz.ch/pipermail/r-devel/2010-October/058729.html > but in any case perhaps th

Re: [Rd] Should there be a confint.mlm ?

2018-07-22 Thread Benjamin Tyner
BTW --- and this is a diversion --- This is nice mathematically (and used in other places, also in "base R" I think) but in principle is a waste: Computing a full k x k matrix and then throwing away all but the length-k diagonal ... In the past I had contemplated but never RFC'ed or really

Re: [Rd] Library lib.loc Option Ignored for Dependencies

2018-07-21 Thread Benjamin Tyner
e package On 07/21/2018 12:34 PM, Martin Maechler wrote: Benjamin Tyner on Fri, 20 Jul 2018 19:42:09 -0400 writes: > Here's a trick/workaround; if lib.loc is the path to your > library, then prior to calling library(), >> environment(.libPaths)$.lib.loc <- lib.

Re: [Rd] Library lib.loc Option Ignored for Dependencies

2018-07-20 Thread Benjamin Tyner
Here's a trick/workaround; if lib.loc is the path to your library, then prior to calling library(), > environment(.libPaths)$.lib.loc <- lib.loc Good day, If there's a library folder of the latest R packages and a

[Rd] missing news entry?

2018-07-18 Thread Benjamin Tyner
Hi, Unless I am mistaken, this enhancement to gc(): r73749 | luke | 2017-11-18 13:26:25 -0500 (Sat, 18 Nov 2017) | 2 lines Added 'full' argument to gc() with default 'TRUE' for now.

Re: [Rd] OpenBLAS in everyday R?

2018-01-11 Thread Benjamin Tyner
condition? On 01/11/2018 07:56 AM, Ista Zahn wrote: On Jan 10, 2018 8:24 PM, "Benjamin Tyner" <bty...@gmail.com <mailto:bty...@gmail.com>> wrote: Thanks Keith. We checked, and indeed libopenblas is not linked against libomp nor libgomp. We suspect this is bec

Re: [Rd] OpenBLAS in everyday R?

2018-01-10 Thread Benjamin Tyner
9, 2018, at 11:01 PM, Benjamin Tyner <bty...@gmail.com> wrote: I didn't do the compile; is there a way to check whether that was used? If not, I'll inquire with our sysadmin and report back. In any case, my suggestion was motivated by the fact that some parts of R use OpenMP while oth

Re: [Rd] OpenBLAS in everyday R?

2018-01-09 Thread Benjamin Tyner
omelet without breaking the OpenMP eggs, so to speak. On 01/09/2018 06:41 PM, Keith O'Hara wrote: Do those issues still arise when OpenBLAS is compiled with USE_OPENMP=1 ? Keith On Jan 9, 2018, at 6:03 PM, Benjamin Tyner <bty...@gmail.com> wrote: Please pardon my ignorance, but doesn't Op

Re: [Rd] OpenBLAS in everyday R?

2018-01-09 Thread Benjamin Tyner
Please pardon my ignorance, but doesn't OpenBLAS still not always play nicely with multi-threaded OpenMP? (for example, don't race conditions sometimes crop up)? If so, it might be nice to have the ability to temporarily disable multi-threaded OpenMP (effectively: omp_set_num_threads(1)) for

Re: [Rd] Coping with non-standard evaluation in R program analysis

2018-01-03 Thread Benjamin Tyner
Evan, The pryr package provides some utilities which may be handy here. In particular see the function: is_promise. Also, next time please post in plaintext. Regards Ben Hello R experts, I plan to develop a tool for dynamic analysis of R programs. I would like to trace function calls at

Re: [Rd] force promises inside lapply

2017-07-31 Thread Benjamin Tyner
; str(f(log(-1), force=TRUE)) List of 4 $ code : language log(-1) $ env : NULL $ evaled: logi TRUE $ value : num NaN Warning message: In log(-1) : NaNs produced Can you give a concrete example of what you are try to accomp

Re: [Rd] force promises inside lapply

2017-07-28 Thread Benjamin Tyner
guage log(-1) $ env : NULL $ evaled: logi TRUE $ value : num NaN Warning message: In log(-1) : NaNs produced Can you give a concrete example of what you are try to accomplish? Bill Dunlap TIBCO Software wdunlap tibco.com <http://tibco.com> On Fri, Jul 28, 2017 at 3:04 PM, Benjamin Tyner

[Rd] force promises inside lapply

2017-07-28 Thread Benjamin Tyner
Hi, I thought I understood the change to lapply semantics resulting from this, https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16093 However, would someone care to explain why this does not work? > L <- list(a=1, b=2, c=3) > str(lapply(L, function(x){ y <- substitute(x);

Re: [Rd] package load altering RNG state

2017-02-07 Thread Benjamin Tyner
Martin, Outstanding! This is a most welcome enhancement. Regards Ben On 02/07/2017 09:59 AM, Martin Maechler wrote: Henric Winell <nilsson.hen...@gmail.com> on Tue, 7 Feb 2017 13:37:42 +0100 writes: > Hi, On 2017-02-07 13:12, Benjamin Tyner wrote:

[Rd] package load altering RNG state

2017-02-07 Thread Benjamin Tyner
Hello When loading a package, I'm wondering if it's frowned upon for the package to alter the state of the random number generator? I guess not, since the parallel package does it? > set.seed(6860) > old.seed <- .GlobalEnv$.Random.seed > library(parallel) > new.seed <-

Re: [Rd] For integer vectors, `as(x, "numeric")` has no effect.

2015-12-07 Thread Benjamin Tyner
Perhaps it is not that surprising, given that > mode(1L) [1] "numeric" and > is.numeric(1L) [1] TRUE On the other hand, this is curious, to say the least: > is.double(as(1L, "double")) [1] FALSE Here's the surprising behavior: x <- 1L xx <- as(x, "numeric")

[Rd] could not find function anyNA when building tools package in R 3.1.1

2014-08-08 Thread Benjamin Tyner
Hello, When building R from source, during the part where the 'tools' package is built, I get: make[6]: Entering directory `/home/btyner/R-3.1.1/src/library/tools/src' make[6]: Leaving directory `/home/btyner/R-3.1.1/src/library/tools/src' make[5]: Leaving directory

[Rd] crossprod(): g77 versus gfortran

2013-03-04 Thread Benjamin Tyner
Hi I've got two builds of R, one using g77 (version 3.4.6) and the other using gfortran (version 4.1.2). The two builds are otherwise identical as far as I can tell. The one which used g77 performs crossprod()s roughly twice as fast as the gfortran one. I'm wondering if this rings a bell with

[Rd] built-in NAMED(obj) from within R

2012-11-09 Thread Benjamin Tyner
Hello, Is it possible to retrieve the 'named' field within the header (sxpinfo) of a object, without resorting to a debugger, external code, etc? In other words is there a built-in equivalent to the getnamed subroutine described here:

Re: [Rd] built-in NAMED(obj) from within R

2012-11-09 Thread Benjamin Tyner
Thanks Matthew and Hadley; that is exactly what I was looking for, and them some. Regards, Ben / The goal is to ascertain whether a copy of an object has been made. // // Then : // // ?tracemem // // One demonstration of using both together is here : // //

[Rd] suggestion for subset.data.frame()

2011-06-22 Thread Benjamin Tyner
Hello, Currently, subset.data.frame() does if (missing(subset)) r - TRUE else { perhaps better might be: if (missing(subset)) r - rep(TRUE, nrow(x)) else { The rationale being, if 'x' has zero rows and 'subset' is missing, we don't want to end up

[Rd] warning or error upon type/storage mode coercion?

2010-09-14 Thread Benjamin Tyner
Hi, I'm aware that the language definition states R objects are often coerced to different types during computations. Two questions: 1. Is it possible to configure the R environment so that, for example, coercion from (say) numeric to integer will throw a warning or an error? I realize that

[Rd] Mksetup() limited to hashing with 32 bits

2010-01-13 Thread Benjamin Tyner
The MKsetup() in unique.c throws an error if the vector to be hashed is longer than (2^32)/8: if(n 0 || n 536870912) /* protect against overflow to -ve */ error(_(length %d is too large for hashing), n); I occasionally work with vectors longer than this on 64-bit builds. Would it

Re: [Rd] bug (PR#13570)

2009-03-10 Thread Benjamin Tyner
wrote: On Thu, 5 Mar 2009, Benjamin Tyner wrote: Hi Nice to hear from you Ryan. I also do not have the capability to debug on windows; however, there is a chance that the behavior you are seeing is caused by the following bug noted in my thesis (available on ProQuest; email me if you don't have

Re: [Rd] bug (PR#13570)

2009-03-05 Thread Benjamin Tyner
Hi Nice to hear from you Ryan. I also do not have the capability to debug on windows; however, there is a chance that the behavior you are seeing is caused by the following bug noted in my thesis (available on ProQuest; email me if you don't have access): When lambda = 0 there are no local

[Rd] data frame with NA in names

2008-02-15 Thread Benjamin Tyner
When calling read.table() and supplying colClasses and header=FALSE, it is possible for the resulting data frame to have NA in the names. (The warning not all columns named in 'colClasses' exist is returned) Here is such a data frame: x - structure(list(a = 1:10, NA = c(NA,

[Rd] suggestion for read.table

2007-09-20 Thread Benjamin Tyner
R-devel, IMHO, in readtable.R, the scan command if (nlines 1) for (i in seq_along(col)) col[i] - length(scan(file, what = , sep = sep, quote = quote, nlines = 1, quiet = TRUE, skip = 0,

Re: [Rd] suggestion for read.table

2007-09-20 Thread Benjamin Tyner
Correction: the warning would be triggered by warning(cols = , cols, != length(data) = , length(data), domain = NA) Ben On 9/20/07, Benjamin Tyner [EMAIL PROTECTED] wrote: R-devel, IMHO, in readtable.R, the scan command if (nlines 1) for (i in seq_along(col

Re: [Rd] hasNA() / anyNA()?

2007-08-14 Thread Benjamin Tyner
Why not hasNA - function(x) !is.na(match(NA, x)) -Ben __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] suggestion with ambiguous object component replacement

2007-08-10 Thread Benjamin Tyner
?[- says When replacing (that is using indexing on the lhs of an assignment) NA does not select any element to be replaced. As there is ambiguity as to whether an element of the rhs should be used or not, this is only allowed if the rhs value is of length one (so the two interpretations would

[Rd] possible bug in 'scan'

2007-06-26 Thread Benjamin Tyner
R-devel, When I run the following code on the attached file, tmp - scan(C:/temp.csv, what=list(character,numeric), sep=,) Then tmp[[2]] is a character vector. My impression from the help file is that it should be a numeric as specified by 'what' sessionInfo() R version

Re: [Rd] possible bug in 'scan'

2007-06-26 Thread Benjamin Tyner
Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Tyner Sent: Tuesday, June 26, 2007 9:59 AM To: r-devel@r-project.org Subject: [Rd] possible

[Rd] possible bug in co.intervals when overlap=0

2006-12-15 Thread Benjamin Tyner
I apologize if this is just a misunderstanding on my part, but I was under the impression that the intervals returned by co.intervals should cover all the observations. Yet x-1:10 z-co.intervals(x,overlap=0) In R, z equals [,1] [,2] [1,] 0.5 1.5 [2,] 2.5 3.5 [3,] 3.5 4.5 [4,] 5.5

Re: [Rd] array indexes in C

2006-11-21 Thread Benjamin Tyner
Hin-Tak Tamas, For example, see what I've done in http://www.stat.purdue.edu/~btyner/postage_0.1-1.tar.gz I am by no means a C guru but it works with my compiler. The relevant lines are (in postage.c:) void postage(int *lambda, int *D, int *tau, int r[*tau][*D]) { (in postage.R:) r -

[Rd] array indexes in C

2006-11-19 Thread Benjamin Tyner
Tamas, You could write convenience functions, but I have used the C99 mechanism for variable length arrays with no problems calling from R. One thing you have to keep in mind though is that (as far as I know) the dimensions must be passed before the array reference. So for example, r -

[Rd] unloadNamespace inside .Last.lib

2006-09-28 Thread Benjamin Tyner
In my package's zzz.R, I put .Last.lib - function(libpath) { unloadNamespace(mypackage) } and I exported .Last.lib in NAMESPACE, with the intent that detaching the package would also cause the name space to be unloaded. However, the result of detach(package:mypackage) is then Error:

[Rd] prefix 'R_' when calling external code

2006-07-01 Thread Benjamin Tyner
I noticed that in https://svn.r-project.org/R/trunk/src/library/stats/R/loess.R that we are now calling R_loess_raw, R_lowesw, R_lowesp, etc. I'm interested to know what is the benefit/reason for the 'R_', as I am unfamiliar with this prefix and do not see it mentioned in 'Writing R

Re: [Rd] custom strip in lattice ignoring plotmath expressions for all but style = 1 (PR#8733)

2006-03-30 Thread Benjamin Tyner
Sorry, so used to it being bundled that I didn't realize lattice was a contributed package. Ben Deepayan Sarkar wrote: 1. Bugs in packages should be reported to the maintainer, not R-bugs. 2. This already works as it should in R 2.3.0 alpha -Deepayan