Re: [Rd] [Sender Not Verified] is(x,"ANY") is FALSE

2023-05-02 Thread Michael Lawrence (MICHAFLA) via R-devel
ded consequence of some > other change? > > Thanks, > —Russell Almond > > > > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Michael Lawrence Se

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

2020-05-18 Thread Michael Lawrence via R-devel
. Shouldn't that raise an error, or at least warning? > > > > Best Regards, > > Jan Gorecki > > > > __ > > R-devel@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > _

Re: [Rd] Possible Regression in setClassUnion between 3.5.0 and 3.6.0

2020-02-25 Thread Michael Lawrence via R-devel
ing again or do you > foresee a lot of changes coming in the 4.* series? > > On Tue, Feb 25, 2020 at 3:39 PM Michael Lawrence via R-devel > wrote: >> >> This seems to work as expected (returning "hi!") in R-devel, but there >> have been so many destabilizin

Re: [Rd] Possible Regression in setClassUnion between 3.5.0 and 3.6.0

2020-02-25 Thread Michael Lawrence via R-devel
This seems to work as expected (returning "hi!") in R-devel, but there have been so many destabilizing changes to methods that it would be tough to port this to release. Probably should just wait for 4.0. Michael On Tue, Feb 18, 2020 at 8:00 PM Michael Lawrence wrote: > > Thanks

Re: [Rd] Possible Regression in setClassUnion between 3.5.0 and 3.6.0

2020-02-18 Thread Michael Lawrence via R-devel
> My sessionInfo() is : > > > > R version 3.6.2 (2019-12-12) > > Platform: x86_64-pc-linux-gnu (64-bit) > > Running under: Ubuntu 18.04.3 LTS > > > > Matrix products: default > > BLAS: /usr/local/lib/R/lib/libRblas.so > > LAPACK: /usr/local/lib/R/lib/lib

Re: [Rd] How to get an object name from C?

2020-01-24 Thread Michael Lawrence via R-devel
> > > substitute(x1) > x1 > > > Best regards, > Daniel > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Michael Lawrence Senior Scientist, Bioinformatics and Computational B

Re: [Rd] Troubles using numeric in s4 class union

2019-11-27 Thread Michael Lawrence via R-devel
gt; > union I defied is somehow interfering with the "index" class union in > > Matrix, R/AllClass.R, line 809 > > > 3. Why should the class union I defined interfere with the inner workings > > of a separate package? > > There is no good reason ... >

Re: [Rd] R C api for 'inherits' S3 and S4 objects

2019-11-01 Thread Michael Lawrence via R-devel
t; SEXP vec = PROTECT(ScalarString(char_)); > SEXP call = PROTECT(lang3(sym_inherits, x, vec)); > bool ans = LOGICAL(eval(call, R_GlobalEnv))[0]==1; > UNPROTECT(2); > return ans; > } > > ______ > R-devel@r-project.org ma

Re: [Rd] S4SXP type vs S4 object bit?

2019-10-22 Thread Michael Lawrence via R-devel
al applications for doing so? > > Thank you > Travers > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Michael Lawrence Scientist,

Re: [Rd] New matrix function

2019-10-11 Thread Michael Lawrence via R-devel
a good reason; maybe someone from the R core team > can shed some light on how they decide whether or not to include a function > in base R? > > > > Duncan Murdoch > > > > [[alternative HTML version deleted]] > >

Re: [Rd] Cryptic error message from namespaceExport

2019-09-21 Thread Michael Lawrence via R-devel
ural of anecdote is not data. ~ Roger Brinner > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > /// > > <https://www.inbo.be> > > > Op vr 6 sep. 2019 o

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

2019-09-21 Thread Michael Lawrence via R-devel
t; > `@<-`(z, "x", value="newer") > An object of class "Z" > Slot "x": > [1] "newer" > > > z > An object of class "Z" > Slot "x": > [1] "orig" > > > > > `slot<-`(z, "x&quo

Re: [Rd] Cryptic error message from namespaceExport

2019-09-06 Thread Michael Lawrence via R-devel
John Tukey > /// > > <https://www.inbo.be> > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/l

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

2019-09-02 Thread Michael Lawrence via R-devel
es. Also, that sounds > like a great design for strcapture with an atomic prototype. > > Best, > CG -- Michael Lawrence Scientist, Bioinformatics and Computational Biology Genentech, A Member of the Roche Group Office +1 (650) 225-7760 micha...@gene.com Join Genentec

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

2019-08-29 Thread Michael Lawrence via R-devel
e to have in base. For example, MATLAB > and Pandas regex both all ow non-dropping empty matches (though of course I acknowledge Pandas is not a base language). > > Best, > CG -- Michael Lawrence Scientist, Bioinformatics and Computational Biology Genentech, A Member of the Roche Gro

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

2019-08-29 Thread Michael Lawrence via R-devel
__ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Michael Lawrence Scientist, Bioinformatics and Computational Biology Genentech, A Member of the Roche Group Office +1 (650) 225-7760 micha...@gene.co

Re: [Rd] Any plans for ALTREP lists (VECSXP)?

2019-07-23 Thread Michael Lawrence via R-devel
mis > Khoury College of Computer Sciences > Northeastern University > kuwisdelu.github.io<https://kuwisdelu.github.io> > > > > > > > > > > > > [[alternative HTML version deleted]] > > __ >

Re: [Rd] Possible bug in `class<-` when a class-specific '[[.' method is defined

2019-07-15 Thread Michael Lawrence via R-devel
s<-` is calling `[[.MYCLASS` 9 times ? > > Is there a way to avoid `class<-` to call `[[.MYCLASS` ? > > > Thank you in advance for your help and suggestions. > > Gionata > > > > [[alternative HTML version deleted]] > > __ >

Re: [Rd] Format printing inside a matrix

2019-07-07 Thread Michael Lawrence via R-devel
> > > Abs > > [[alternative HTML version deleted]] > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel -- Michael Lawrence Scientist, Bioinformatics and Computational Biolo

Re: [Rd] topenv of emptyenv

2019-03-28 Thread Michael Lawrence via R-devel
And it is used profusely by the methods package. On Thu, Mar 28, 2019 at 4:53 AM Gábor Csárdi wrote: > On Thu, Mar 28, 2019 at 11:43 AM Martin Maechler > wrote: > [...] > > > > Indeed... and as I mentioned I had never actively noticed the > > use of topenv() at all... > > FWIW topenv() is used

Re: [Rd] [RFC] readtable enhancement

2019-03-28 Thread Michael Lawrence via R-devel
Gabe described my main concern. Specifying a coercion function asserts that the data (1) were what was expected and (2) were converted into what was expected. Allowing a coercer to delegate to a "next method" is a good idea, but keep in mind that any function that did that would not confer the bene

Re: [Rd] [RFC] readtable enhancement

2019-03-27 Thread Michael Lawrence via R-devel
This has some nice properties: 1) It self-documents the input expectations in a similar manner to colClasses. 2) The implementation could eventually "push down" the coercion, e.g., calling it on each chunk of an iterative read operation. The implementation needs work though, and I'm not convinced

Re: [Rd] [PATCH 1/2] readtable: add hook for type conversions per column

2019-03-26 Thread Michael Lawrence via R-devel
Please file a bug on bugzilla so we can discuss this further. On Tue, Mar 26, 2019 at 11:53 AM Kurt Van Dijck < dev.k...@vandijck-laurijssen.be> wrote: > Hello, > > I want to find out if this patch is ok or not, and if not, what should > change. > > Kind regards, > Kurt > > __

Re: [Rd] selectMethod() can fail to find methods in situations of multiple dispatch

2019-03-21 Thread Michael Lawrence via R-devel
be put on the roadmap. The alias instability and the fact that the user > has no way to know if s/he should do ?`foo,numeric-method` or > ?`foo,numeric,ANY-method` to find the method has been a long-standing > problem. > > H. > On 3/21/19 21:29, Michael Lawrence wrote: > > I

Re: [Rd] selectMethod() can fail to find methods in situations of multiple dispatch

2019-03-21 Thread Michael Lawrence via R-devel
he > ANY suffix in its signature gets added to the ecosystem. See my post about > this to the Bioc-devel mailing list a couple of months ago: > https://stat.ethz.ch/pipermail/bioc-devel/2019-January/014603.html > > So overall isn't this truncation more trouble than it's

Re: [Rd] selectMethod() can fail to find methods in situations of multiple dispatch

2019-03-19 Thread Michael Lawrence via R-devel
This is due to the intentional truncation of ANY suffixes from method signatures. I've hacked selectMethod() to be robust to that and will commit soon. Thanks for the report. Michael On Thu, Mar 14, 2019 at 9:32 AM Pages, Herve wrote: > Here is an example: > > setGeneric("foo", function(x, y)

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

2019-01-10 Thread Michael Lawrence via R-devel
Thanks for the report. There is a comment from 2001 in the header for reconcilePropertiesAndPrototype() that states: "The prototype may imply slots not in the properties list. It is not required that the extends classes be define at this time. Should it be?" But somewhere in the mid 2000's, I t

Re: [Rd] Unexpected argument-matching when some are missing

2018-11-30 Thread Michael Lawrence
Argument matching is by name first, then the still missing arguments are filled positionally. Unnamed missing arguments are thus left missing. Does that help? Michael On Fri, Nov 30, 2018 at 8:18 AM Emil Bode wrote: > > But the main point is where arguments are mixed together: > > > debugonce(plo

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

2018-11-28 Thread Michael Lawrence
Whenever they are calling a primitive, because primitives match arguments positionally. Of course, you then you need to introduce the concept of a primitive. You could also make an argument from the code clarity perspective, as typically primitives have simple interfaces and/or are used frequently

Re: [Rd] Bug 17432 in readLines with R >= 3.5.0 still a problem

2018-09-14 Thread Michael Lawrence
432) later than June > 1, 2018. Would you please supply a link pointing to the followup to this > discussion on bugzilla? > > Thanks. > > Jen. > > > On Thu Sep 13 14:14:46 CEST 2018 Michael Lawrence wrote: > > > > Thanks, I responded to this on bugzilla. &

Re: [Rd] Bug 17432 in readLines with R >= 3.5.0 still a problem

2018-09-13 Thread Michael Lawrence
Thanks, I responded to this on bugzilla. On Wed, Sep 12, 2018 at 9:04 AM Chris Culnane wrote: > > Bug 17432 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17432) is > still a problem when using pipes for IPC. > > The bug is evident when calling R from another process and trying to > commu

Re: [Rd] WishList: Remove Generic Arguments

2018-08-09 Thread Michael Lawrence
A generic function is not simply a way to name two functions (methods) the same. It has a particular purpose, and the argument names are aligned with and convey that purpose. The methods only implement polymorphism; they don't change the purpose. Changing the purpose would make code unreadable. Mi

Re: [Rd] R History: Why is there no importFrom() function?

2018-07-22 Thread Michael Lawrence
I can't speak to the history per se, but I can give an opinion on the current situation. R is a programming language, as is Python, but R is also a system for interactive data analysis. Outside of the software/package context, library() is almost always sufficient. When it is not, consider "foo <-

Re: [Rd] list of methods

2018-06-26 Thread Michael Lawrence
While it's easy to conceive of a utility that found all generics for which there is no non-default method for a given class vector, it's not clear it would be useful, because it depends on the nature of the object. Surv objects are vector-like, so they need to implement the "vector API", which is n

Re: [Rd] readLines function with R >= 3.5.0

2018-06-19 Thread Michael Lawrence
4914) > and it works, while with r-patched (r74914) it does not work (it hangs, as > it did in R 3.5.0). I apologize for it taking so long for me to test this, > but is there any chance this fix could make into R 3.5.1? > > Thanks. > > Jen. > > On Wed, Jun 13, 2018 at 6:24

Re: [Rd] readLines function with R >= 3.5.0

2018-06-13 Thread Michael Lawrence
Are you sure it's not available in patched? It's definitely in the source since 6/1. Michael On Wed, Jun 13, 2018 at 2:19 AM, Martin Maechler wrote: >>>>>> Michael Lawrence >>>>>> on Tue, 12 Jun 2018 19:27:49 -0700 writes: > > >

Re: [Rd] readLines function with R >= 3.5.0

2018-06-12 Thread Michael Lawrence
Hi Jen, This was already resolved for R 3.5.1 by just disabling buffering on terminal file connections like stdin. Sounds like you might want to be running a web service or something instead though. Michael On Tue, Jun 12, 2018 at 4:46 PM, Jennifer Lyon wrote: > Hi: > > I have also just stumbl

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Michael Lawrence
Actually, it's sort of the opposite. Everything becomes a sequence of integers internally, even when the argument is missing. So the same amount of work is done, basically. ALTREP will let us improve this sort of thing. Michael On Fri, Jun 8, 2018 at 1:49 PM, Hadley Wickham wrote: > Hmmm, yes, t

Re: [Rd] Subsetting the "ROW"s of an object

2018-06-08 Thread Michael Lawrence
There probably should be an abstraction for this. In S4Vectors, we have extractROWS(). Michael On Fri, Jun 8, 2018 at 8:45 AM, Hadley Wickham wrote: > Hi all, > > Is there a better to way to subset the ROWs (in the sense of NROW) of > an vector, matrix, data frame or array than this? > > subset_

Re: [Rd] Creating S3 methods for S4 classes (coming from r-package-devel)

2018-05-24 Thread Michael Lawrence
On Thu, May 24, 2018 at 10:47 AM, Joris Meys wrote: > > > On Thu, May 24, 2018 at 6:20 PM, Michael Lawrence > wrote: >> >> You only have to make an S4 method if there is already an S4 generic. >> If there is just an S3 generic, then just define S3 methods on i

Re: [Rd] Creating S3 methods for S4 classes (coming from r-package-devel)

2018-05-24 Thread Michael Lawrence
You only have to make an S4 method if there is already an S4 generic. If there is just an S3 generic, then just define S3 methods on it. I think we should stay away from defining S4 generics when there is no good reason for them. Good reasons include multiple dispatch, or a non-default signature. N

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Michael Lawrence
On Wed, May 16, 2018 at 3:45 PM, Hervé Pagès wrote: > On 05/16/2018 01:24 PM, Michael Lawrence wrote: >> >> On Wed, May 16, 2018 at 12:23 PM, Hervé Pagès >> wrote: >>> >>> On 05/16/2018 10:22 AM, Michael Lawrence wrote: >>>> >>>> >

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Michael Lawrence
On Wed, May 16, 2018 at 12:23 PM, Hervé Pagès wrote: > On 05/16/2018 10:22 AM, Michael Lawrence wrote: >> >> Factors and data.frames are not structures, because they must have a >> class attribute. Just call them "objects". They are higher level than >> str

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Michael Lawrence
ior and design of R itself, but I'm not sure it's worth doing anything about them at this point. Michael On Wed, May 16, 2018 at 8:33 AM, Hervé Pagès wrote: > On 05/15/2018 09:13 PM, Michael Lawrence wrote: >> >> My understanding is that array (or any other structure) does

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-15 Thread Michael Lawrence
My understanding is that array (or any other structure) does not "simply" inherit from vector, because structures are not vectors in the strictest sense. Basically, once a vector gains attributes, it is a structure, not a vector. The methods package accommodates this by defining an "is" relationshi

Re: [Rd] readLines() behaves differently for gzfile connection

2018-05-14 Thread Michael Lawrence
mpty lines issue also. Michael On Thu, May 10, 2018 at 4:21 PM, Ben Heavner wrote: > You bet - it's available on github at > https://github.com/UW-GAC/wgsaparsr/blob/master/tests/testthat/1k_annotation.gz > > -Ben > > On Thu, May 10, 2018 at 4:17 PM, Michael Lawrence >

Re: [Rd] readLines() behaves differently for gzfile connection

2018-05-10 Thread Michael Lawrence
Would it be possible to get that file or a representative subset of it somewhere so that I can reproduce this? Thanks, Michael On Thu, May 10, 2018 at 3:31 PM, Ben Heavner wrote: > When I read a .gz file with readLines() in 3.4.3, it returns text (and a > warning). In 3.5.0, it gives a warning,

Re: [Rd] readLines() for non-blocking pipeline behaves differently in R 3.5

2018-04-26 Thread Michael Lawrence
"3\n", file = "foobar", append = TRUE) > readLines(f) > #> [1] "3" > > I.e. R can emulate a file connection with non-blocking reads. > AFAICT there is no such thing, in Unix at least. > For this emulation, it needs to seek to the "current"

Re: [Rd] readLines() for non-blocking pipeline behaves differently in R 3.5

2018-04-26 Thread Michael Lawrence
is seeking in the first place. Anyway, I'll get this into patched ASAP. Thanks for the report. Michael On Wed, Apr 25, 2018 at 5:13 PM, Michael Lawrence wrote: > Probably related to the switch to buffered connections. I will look > into this soon. > > On Wed, Apr 25, 2018 at

Re: [Rd] readLines() for non-blocking pipeline behaves differently in R 3.5

2018-04-25 Thread Michael Lawrence
Probably related to the switch to buffered connections. I will look into this soon. On Wed, Apr 25, 2018 at 2:34 PM, Randy Lai wrote: > It seems that the behavior of readLines() in R 3.5 has changed for > non-blocking pipeline. > > > Consider the following R script, which reads from STDIN line b

Re: [Rd] odd assignInNamespace / setGeneric interaction

2018-04-19 Thread Michael Lawrence
uot;)), getNamespace("graphics")) >> library(stats4) >> > > I suppose poeple who use assignInNamespace get what they deserve. > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Thu, Apr 19, 2018 at 2:33 AM, Martin Maechler > wrote: &g

Re: [Rd] odd assignInNamespace / setGeneric interaction

2018-04-18 Thread Michael Lawrence
Hi Bill, Ideally, your coworker would just make an alias (or shortcut or whatever) for R that passed --no-save to R. I'll try to look into this though. Michael On Wed, Apr 18, 2018 at 1:38 PM, William Dunlap via R-devel wrote: > A coworker got tired of having to type 'yes' or 'no' after quittin

Re: [Rd] Workflow for translations?

2018-03-25 Thread Michael Lawrence
Hi Detlef, Sorry, this is something that I have been supposed to be doing. I will send out a call soon. Michael On Sun, Mar 25, 2018 at 10:00 AM, Detlef Steuer wrote: > Hi friends, > > what happend to the "call for translation" that was a clear > signal to start working on an update for transa

Re: [Rd] Best practices in developing package: From a single file

2018-02-02 Thread Michael Lawrence
On Thu, Feb 1, 2018 at 9:20 AM, Gabriel Becker wrote: > On Thu, Feb 1, 2018 at 5:24 AM, Lionel Henry wrote: > > > On 31 janv. 2018, at 09:08, Gabriel Becker wrote: > > > > > it *actively discourages* the bits it doesn't directly support. > > > > It may be discouraging to include Rd syntax in ro

Re: [Rd] Fwd: Re: Best practices in developing package:

2018-02-01 Thread Michael Lawrence
Folding is a simple solution, but there are intrinsic problems, like the need to embed the documentation in comments. If the user already has to expand a fold to edit the docs, the IDE could instead just provide a link or shortcut that jumps to a separate documentation file, written in whatever lan

Re: [Rd] as.list method for by Objects

2018-02-01 Thread Michael Lawrence
On Thu, Feb 1, 2018 at 1:21 AM, Martin Maechler wrote: > >>>>> Michael Lawrence > >>>>> on Tue, 30 Jan 2018 10:37:38 -0800 writes: > > > I agree that it would make sense for the object to have c("by", > "list") as &

Re: [Rd] bug [methods]: double execution of `insertSource` within the same session does not work

2018-01-31 Thread Michael Lawrence
The issue should be resolved in R-devel. It was actually deeper and more important than this obscure insertSource() function. names() was not doing the right thing on S4 objects derived from "environment". On Mon, Jan 29, 2018 at 11:02 AM, Michael Lawrence wrote: > Thanks, I

Re: [Rd] Best practices in developing package: From a single file

2018-01-31 Thread Michael Lawrence
I pretty much agree. I tried using roxygen when it was first released but couldn't stand putting documentation in comments, especially for complex, S4-based software. Rd is easy to read and write and lets me focus on the task of writing documentation (focus is the hardest part of any task for me).

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Michael Lawrence
thods package. It deals in "class space" while as.list() deals in "typeof() space". Michael On Tue, Jan 30, 2018 at 3:47 PM, Hervé Pagès wrote: > On 01/30/2018 02:50 PM, Michael Lawrence wrote: > >> by() does not always return a list. In Gabe's example, it retu

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Michael Lawrence
by() does not always return a list. In Gabe's example, it returns an integer, thus it is coerced to a list. as.list() means that it should be a VECSXP, not necessarily with "list" in the class attribute. Michael On Tue, Jan 30, 2018 at 2:41 PM, Hervé Pagès wrote: > Hi Gabe, > > Interestingly th

Re: [Rd] as.list method for by Objects

2018-01-30 Thread Michael Lawrence
I agree that it would make sense for the object to have c("by", "list") as its class attribute, since the object is known to behave as a list. However, it would may be too disruptive to make this change at this point. Hard to predict. Michael On Mon, Jan 29, 2018 at 5:00 PM, Dario Strbenac wrote

Re: [Rd] bug [methods]: double execution of `insertSource` within the same session does not work

2018-01-29 Thread Michael Lawrence
Thanks, I will fix this. On Mon, Jan 29, 2018 at 8:06 AM, Demetrio Rodriguez T. < demetrio.rodrigue...@gmail.com> wrote: > Hello everyone, > > > I hope this reaches someone at all. It's my first bug report to the R-core, > and, apparently, bugzilla is locked from new reports for now. > > I was us

Re: [Rd] R (>= 3.4.0): integer-to-double coercion in comparisons no longer done (a good thing)

2018-01-27 Thread Michael Lawrence
Thanks for highlighting this. I just made the change one day. Guess I should have mentioned it in the NEWS. Michael On Sat, Jan 27, 2018 at 3:01 PM, Henrik Bengtsson < henrik.bengts...@gmail.com> wrote: > Hi, > > there was a memory improvement done in R going from R 3.3.3 to R 3.4.0 > when it co

Re: [Rd] S4 method implementation for S3 class

2017-09-22 Thread Michael Lawrence
On Fri, Sep 22, 2017 at 10:28 AM, Iñaki Úcar wrote: > 2017-09-22 19:04 GMT+02:00 Michael Lawrence : >> The %*% function is a primitive. As it says in the documentation under >> ?Methods_Details >> >> Methods may be defined for most primitives, and corresponding &g

Re: [Rd] S4 method implementation for S3 class

2017-09-22 Thread Michael Lawrence
The %*% function is a primitive. As it says in the documentation under ?Methods_Details Methods may be defined for most primitives, and corresponding metadata objects will be created to store them. Calls to the primitive still go directly to the C code, which will sometimes che

Re: [Rd] Problems with S4 methods dispatching on `...` (aka dotsMethods)

2017-08-07 Thread Michael Lawrence
; setGeneric("f", signature = "...") > > # unexpectedly fails to find 'b' > f() > ## Error in print(a) : object 'b' not found > > > On Fri, Jul 28, 2017 at 9:15 PM, Michael Lawrence < > lawrence.mich...@gene.com> wro

Re: [Rd] Problems with S4 methods dispatching on `...` (aka dotsMethods)

2017-07-28 Thread Michael Lawrence
gt; wrote: >> >> You're right, I must have mixed up my R versions when running the example, >> as the problem seems to be resolved in R-devel. >> >> Sorry for the noise and thanks again for fixing this. >> >> Andrzej >> >> On Tue, Apr 25,

Re: [Rd] paste strings in C

2017-06-27 Thread Michael Lawrence
To do this in C, it would probably be easier and faster to just do the string manipulation directly. Luckily, there are already packages that have done this for you. See an example below using the S4Vectors package. foo2 <- function(mymat, colnms, tilde=FALSE) { chars <- colnms[col(mymat)]

Re: [Rd] surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)

2017-06-06 Thread Michael Lawrence
I've fixed this and will commit soon. Disregard my dim<-() example; that behaves as expected (the class needs a dim<-() method). Michael On Tue, Jun 6, 2017 at 5:16 AM, Michael Lawrence wrote: > Thanks for the report. The issue is that one cannot set special attributes >

Re: [Rd] surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)

2017-06-06 Thread Michael Lawrence
Thanks for the report. The issue is that one cannot set special attributes like names, dim, dimnames, etc on S4 objects. I was aready working on this and will have a fix soon. > a2 <- new("A2") > dim(a2) <- c(2, 3) Error in dim(a2) <- c(2, 3) : invalid first argument On Mon, Jun 5, 2017 at 6:08

Re: [Rd] `match.call` and dots substitution

2017-04-30 Thread Michael Lawrence
The result of match.call() should be something that would evaluate correctly in the frame of the fun0() call. While wrapping things in parentheses is unlikely to cause any problems, arbitrary calls and symbols would. Consider the following: fun0 <- function(a, ...) { x <- 2L fun1(...) } f

Re: [Rd] Problems with S4 methods dispatching on `...` (aka dotsMethods)

2017-04-25 Thread Michael Lawrence
in print(a) : object 'b' not found > > > Any chances of fixing this? > > Cheers, > Andrzej > > > > On Fri, Apr 21, 2017 at 11:40 AM, Andrzej Oleś > wrote: >> >> Great, thanks Michael for you quick response! >> >> I started off with a

Re: [Rd] Problems with S4 methods dispatching on `...` (aka dotsMethods)

2017-04-20 Thread Michael Lawrence
Thanks for pointing out these issues. I have a fix that I will commit soon. Btw, I would never have seen the post on Stack Overflow. It's best to report bugs on the bugzilla. Michael On Thu, Apr 20, 2017 at 8:30 AM, Andrzej Oleś wrote: > Hi all, > > I recently encountered some unexpected behavi

Re: [Rd] Crash after (wrongly) applying product operator on S4 object that derives from list

2017-04-19 Thread Michael Lawrence
I think this is a known issue with Java messing with the stack, see e.g. http://r.789695.n4.nabble.com/Error-memory-exhausted-limit-reached-td4729708.html. I'll fix the infinite recursion caused by the methods package. Michael On Wed, Apr 19, 2017 at 1:12 AM, Wolfgang Huber wrote: > Dear Hilma

Re: [Rd] `[` not recognized as a primitive in certain cases.

2017-03-28 Thread Michael Lawrence
There is a difference between the symbol and the function (primitive or closure) to which it is bound. This: mc2 <- as.call(list(`[`,iris,2,"Species")) Evaluates `[` to its value, in this case the primitive object, and the primitive itself is incorporated into the returned call. If you were to d

Re: [Rd] RFC: (in-principle) native unquoting for standard evaluation

2017-03-18 Thread Michael Lawrence
s some built in support. > > Hadley > > > On Friday, March 17, 2017, Michael Lawrence > wrote: >> >> Interesting idea. Lazy and non-standard evaluation is going to happen; the >> language needs a way to contain it. >> >> I'll extend the proposal so t

Re: [Rd] RFC: (in-principle) native unquoting for standard evaluation

2017-03-17 Thread Michael Lawrence
if I have any of that confused or there are better approaches. I > merely have a desire for this to work and am learning as much as possible > about "how" as I go. > > Your comments are greatly appreciated. > > - Jonathan. > > On Fri, 17 Mar 2017 at 21:00, Michael Law

Re: [Rd] RFC: (in-principle) native unquoting for standard evaluation

2017-03-17 Thread Michael Lawrence
Interesting idea. Lazy and non-standard evaluation is going to happen; the language needs a way to contain it. I'll extend the proposal so that prefixing a formal argument with @ in function() marks the argument as auto-quoting, so it arrives as a language object without use of substitute(). Kind

Re: [Rd] Support for user defined unary functions

2017-03-16 Thread Michael Lawrence
I guess this would establish a separate "namespace" of symbolic prefix operators, %*% being an example in the infix case. So you could have stuff like %?%, but for non-symbolic (spelled out stuff like %foo%), it's hard to see the advantage vs. foo(x). Those examples you mention should probably be

Re: [Rd] can we override "if" in R?

2017-03-05 Thread Michael Lawrence
side effects unless the deferral is complete. > Best, > Da > > On Sat, Mar 4, 2017 at 3:22 PM, Michael Lawrence > wrote: > > I'm curious as to precisely why someone would want to do this. > > > > On Sat, Mar 4, 2017 at 11:49 AM, Da Zheng wrote: > >>

Re: [Rd] can we override "if" in R?

2017-03-04 Thread Michael Lawrence
I'm curious as to precisely why someone would want to do this. On Sat, Mar 4, 2017 at 11:49 AM, Da Zheng wrote: > I'm just curious. Why making "if" generic is even more dangerous? > > Best, > Da > > On Sat, Mar 4, 2017 at 1:22 PM, Gábor Csárdi > wrote: > > `!` is a generic, `if` is not. You can

Re: [Rd] Control statements with condition with greater than one should give error (not just warning) [PATCH]

2017-03-04 Thread Michael Lawrence
Is there really a need for these complications? Packages emitting this warning are broken by definition and should be fixed. Perhaps we could "flip the switch" in a test environment and see how much havoc is wreaked and whether authors are sufficiently responsive? Michael On Sat, Mar 4, 2017 at 1

Re: [Rd] new function to tools/utils package: dependencies based on DESCRIPTION file

2016-11-17 Thread Michael Lawrence
: > Hi Michael, > Are you willing to accept patch for this? I'm already using this and > few related functions for a while, it plays well. I could wrap it as > patch to utils, or tools? > Best, > Jan > > On 16 June 2016 at 14:00, Michael Lawrence wrote: >> I agre

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Michael Lawrence
<- as.pairlist(expr[[2]]) >> expr > function(x = NULL) x > > > I agree it would be nice to fix this for consistency, but if you bump > into major issues, at least I can live with having to use an explicit > as.pairlist(). > > Thanks > > Henrik > > On

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Michael Lawrence
Hi Henrik, It would help to understand your use case for pairlists. Thanks, Michael On Wed, Oct 12, 2016 at 9:40 AM, Michael Lawrence wrote: > The coercion is probably the most viable workaround for now, as it's > consistent with what happens internally for calls. All pairlists/

Re: [Rd] How to assign NULL value to pairlist element while keeping it a pairlist?

2016-10-12 Thread Michael Lawrence
The coercion is probably the most viable workaround for now, as it's consistent with what happens internally for calls. All pairlists/calls are converted to list for subassignment, but only calls are converted back. My guess is that the intent was for users to move from using a pairlist to the "new

Re: [Rd] error handling in strcapture

2016-10-04 Thread Michael Lawrence
) : > data length [20] is not a sub-multiple or multiple of the number of rows > [7] >> strcapture("(.)(.)(.)", c("abc", "def"), proto=list(A="")) > A > 1 a > 2 c > 3 d > 4 f > > > Bill Dunlap > TIBCO Software > wdunl

Re: [Rd] error handling in strcapture

2016-10-04 Thread Michael Lawrence
all.equal(e9p, r9p) > } > #Error in if (any(ind)) { : missing value where TRUE/FALSE needed > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Wed, Sep 21, 2016 at 2:32 PM, Michael Lawrence > wrote: >> >> The new behavior is that it yields N

Re: [Rd] as.character.factor and S4 object containing factor

2016-09-22 Thread Michael Lawrence
The issue with as.character.factor() was reported and fixed recently. https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17141 The warning emitted from print.factor() is interesting. I'm not sure why we are setting the class to NULL there. Could just create a new character vector instead. Will l

Re: [Rd] error handling in strcapture

2016-09-21 Thread Michael Lawrence
ld strcapture just assume the best > and fill in the prototype with NA's? > > Should there be warnings? This is kind of like strptime(), which silently > gives NA's when the format does not match the text input. > > > Bill Dunlap > TIBCO Software > wdunlap

Re: [Rd] error handling in strcapture

2016-09-21 Thread Michael Lawrence
Hi Bill, Thanks, another good suggestion. strcapture() now returns NAs for non-matches. It's nice to have someone kicking the tires on that function. Michael On Wed, Sep 21, 2016 at 12:11 PM, William Dunlap via R-devel wrote: > Michael, thanks for looking at my first issue with utils::strcaptur

Re: [Rd] strcapture enhancement

2016-09-21 Thread Michael Lawrence
Thanks for the suggestion. Checked in that change. Michael On Wed, Sep 21, 2016 at 11:06 AM, William Dunlap via R-devel wrote: > The new strcapture function in R-devel is handy, capturing > the matches to the parenthesized subpatterns in a regular > expression in the columns of a data.frame, who

Re: [Rd] c(, ) / help(dotsMethods) etc

2016-09-10 Thread Michael Lawrence
One option would be to use the same strategy that we use for cbind() and rbind(), i.e., if dispatch fails, call a binary generic, c2(), recursively. Could do the same for pmin() and pmax(). Michael On Sat, Sep 10, 2016 at 8:27 AM, Martin Maechler wrote: > I have been asked (by Roger; thank you

Re: [Rd] sort.int(c(2, NA, 4), index.return=TRUE, na.last=NA, method)$ix differ for method="radix" and "shell"/"quick" (+ new default in R-devel)

2016-08-25 Thread Michael Lawrence
The radix sort should be consistent with the others, i.e., it should behave like sort.list(), not order(). I will correct this. On Thu, Aug 25, 2016 at 4:39 PM, Henrik Bengtsson wrote: > Does sort.int(c(2,NA,4), index.return=TRUE, na.last=NA, > method="radix")$ix give the intended result, because

Re: [Rd] stack problem

2016-06-27 Thread Michael Lawrence
original. > > LL <- list(z = 1:3, a = list()) > # since we can't do s <- stack(LL,. drop = FALSE) do this instead: > s <- transform(stack(LL), ind = factor(as.character(ind), levels = names(LL))) > unstack(s) > > > > > On Mon, Jun 27, 2016 at 2:55 PM, Mic

Re: [Rd] stack problem

2016-06-27 Thread Michael Lawrence
I'll add the drop argument but I'm wondering about the order of the levels. Should we set the levels to unique(names(x)) or sort them, too? On Mon, Jun 27, 2016 at 10:39 AM, Gabor Grothendieck wrote: > stack() seems to drop empty levels. Perhaps there could be a > drop=FALSE argument if one want

Re: [Rd] new function to tools/utils package: dependencies based on DESCRIPTION file

2016-06-16 Thread Michael Lawrence
I agree that the utils package needs some improvements related to this, and hope to make them eventually. This type of feedback is very helpful. Thanks, Michael On Thu, Jun 16, 2016 at 1:42 AM, Jan Górecki wrote: > Dear Joris, > > So it does looks like the proposed function makes a lot sense t

Re: [Rd] cumsum method in Math group

2016-06-09 Thread Michael Lawrence
On Thu, Jun 9, 2016 at 1:13 AM, Edzer Pebesma wrote: > When running > > a = runif(10) > class(a) = "foo" > Math.foo = function(x, ...) { > NextMethod(.Generic) > } > signif(a, 3) > cumsum(a) > > > I don't understand why cumsum strips the class, but signif does not. > Both claim in the document

Re: [Rd] Suggestion: mkString(NULL) should be NA

2016-05-25 Thread Michael Lawrence
On Wed, May 25, 2016 at 4:23 AM, Jeroen Ooms wrote: > On Wed, May 25, 2016 at 12:31 PM, Martin Maechler > wrote: > > Better than segfaulting, yes, but really agree with Bill (and > > Gabe), also for Rf_mkChar(NULL): > > I think both functions should give an error in such a case > > rather than r

Re: [Rd] discussion of change in R 3.3.0 to [<-

2016-05-17 Thread Michael Lawrence
I was looking into making sub-assignment into atomic vectors work when the value is an S4 object. The plan was to simply dispatch to an as.vector method and proceed as normal. Currently, if 'x' is a list, then any S4 'value' is first wrapped in a list. One can rationalize this by thinking of the S

  1   2   3   >