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] 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] 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] 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
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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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() 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() 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] 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] 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-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
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] 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] 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] 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] 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] 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] 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-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] 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] 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] 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] 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] 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] 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] 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] Feature request: put NewEnvironment and R_NewhashedEnv into API

2010-09-03 Thread Michael Lawrence
What about allocSExp(ENVSXP)? Then SET_ENCLOS() to set the parent? Seems to work for me. Michael On Sun, Aug 29, 2010 at 11:02 AM, Oliver Flasch wrote: > Hi, > > as Seth Falcon in 2006, I also need to create new environments from package > C code. Unfortunately, both NewEnvironment and R_NewHash

Re: [Rd] what is the best way for an external interface to interact with graphics, libraries

2010-09-08 Thread Michael Lawrence
On Tue, Sep 7, 2010 at 11:34 AM, Simon Urbanek wrote: > > On Sep 7, 2010, at 2:21 PM, ghostwheel wrote: > > > > > Another message about the R to TeXmacs interface. > > > > 1. Graphics > > The TeXmacs interface allows the user to directly insert graphics into > the > > session. > > > > Since I am n

Re: [Rd] lapply version with [ subseting - a suggestion

2010-09-21 Thread Michael Lawrence
On Tue, Sep 21, 2010 at 3:55 AM, Vitaly S. wrote: > > Dear R developers, > > Reviewing my code, I have realized that about 80% of the time in the lapply > I > need to access the names of the objects inside the loop. > > In such cases I iterate over indexes or names: > lapply(names(x), ... [i]), >

Re: [Rd] [R] R-2.12.0 hangs while loading RGtk2 on FreeBSD

2010-10-22 Thread Michael Lawrence
t function, perhaps you could step through until it hangs. Thanks, Michael > I think this is rather technical for R-help, so maybe move to R-devel? >> > > I moved to R-devel. > > And can you check the RGtk2 version? A recent but not current version >> (2.12.17?) did han

Re: [Rd] R-2.12.0 hangs while loading RGtk2 on FreeBSD

2010-10-27 Thread Michael Lawrence
On Sat, Oct 23, 2010 at 2:49 AM, Rainer Hurling wrote: > On 22.10.2010 22:10 (UTC+1), Rainer Hurling wrote: > >> On 22.10.2010 16:18 (UTC+2), Rainer Hurling wrote: >> >>> On 22.10.2010 14:57 (UTC+1), Michael Lawrence wrote: >>> >>>> >>&

Re: [Rd] R-2.12.0 hangs while loading RGtk2 on FreeBSD

2010-10-28 Thread Michael Lawrence
On Wed, Oct 27, 2010 at 12:09 PM, Rainer Hurling wrote: > On 27.10.2010 15:07 (UTC+1), Michael Lawrence wrote: > >> On Sat, Oct 23, 2010 at 2:49 AM, Rainer Hurling > <mailto:rhur...@gwdg.de>> wrote: >>On 22.10.2010 22:10 (UTC+1), Rainer Hurling wrote: >&g

Re: [Rd] Scripting SVG with R

2010-10-29 Thread Michael Lawrence
Lots of interesting responses to this, but I would add that the qtbase package allows for interesting hybrid applications between the web/javascript and R. Qt includes a WebKit port, which is integrated with the QtScript module, a javascript implementation. With qtbase, one could hypothetically e

[Rd] subassignment does not always duplicate object from active binding

2011-02-09 Thread Michael Lawrence
Hi guys, I think there might be an issue with the NAMED value on the object returned by an active binding. For example, with the latest R devel, env <- new.env(parent=emptyenv()) makeBinding <- function(data) { force(data) function(new) { if (missing(new)) data else { pri

[Rd] hook for when R quits

2011-03-11 Thread Michael Lawrence
Hi, Is there any way that a package can listen for when R quits? The Qt stuff is hooking into platform-specific event loops and when those die unexpectedly (from the perspective of Qt), it aborts, causing an annoying error dialog. If we could catch when R is killed, we could cleanup, like we do wi

Re: [Rd] hook for when R quits

2011-03-11 Thread Michael Lawrence
nally that would persist until R exits - and a related function > to handle cleanup of course. > > HTH > Jeff > > On Fri, Mar 11, 2011 at 12:08 PM, Michael Lawrence > wrote: > > Hi, > > > > Is there any way that a package can listen for when R quits? The Qt st

[Rd] possibly invalid assertion in setRefClass?

2011-06-01 Thread Michael Lawrence
> setRefClass("Foo", fields = list()) Error in setRefClass("Foo", fields = list()) : A list argument for fields must have nonempty names for all the fields In my opinion, the above should not fail. There are no fields. Thanks, Michael [[alternative HTML version deleted]] _

Re: [Rd] Require of gWidgetsRGtk2 fails: RGtk2.dll can't be found, but it's there

2011-06-11 Thread Michael Lawrence
I'm working on a mechanism that will download GTK+ (the official zip files) into a predetermined location and put that location in front of the other paths at load time. Hopefully this will resolve these continuing issues. Michael On Fri, Jun 10, 2011 at 6:07 AM, Janko Thyson < janko.thyson.rst.

[Rd] invalid body argument for function

2011-06-29 Thread Michael Lawrence
Hi guys, Looks like mkCLOSXP cannot handle external pointers as the function body. Work around is obvious, but I guess it's a bug nonetheless. > library(RGtk2) > fun <- eval(substitute(function() x, list(x = gtkWindow( Error in eval(expr, envir, enclos) : invalid body argument for "function"

Re: [Rd] invalid body argument for function

2011-07-08 Thread Michael Lawrence
On Thu, Jun 30, 2011 at 9:35 AM, Duncan Murdoch wrote: > On 29/06/2011 9:09 PM, Michael Lawrence wrote: > >> Hi guys, >> >> Looks like mkCLOSXP cannot handle external pointers as the function body. >> Work around is obvious, but I guess it's a bug nonetheless

[Rd] Win7 x64 "device not ready" error when DLLpath passed to dyn.load

2011-08-10 Thread Michael Lawrence
Hi, Does anyone have any idea why some installations of 64 bit Windows 7 yields an error like this when passing DLLpath to dyn.load or library.dynam? > library(RGtk2) Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'c:/R/libuser/RGtk2/libs/x64/ RGtk2.dll'

[Rd] relist.list broken for skeletons with empty elements

2011-08-11 Thread Michael Lawrence
Hi guys, This seems wrong: > x <- list(2, numeric()) > relist(unlist(x), x) [[1]] [1] 2 [[2]] [1] NA 2 Here is the definition: function (flesh, skeleton = attr(flesh, "skeleton")) { ind <- 1L result <- skeleton for (i in seq_along(skeleton)) { size <- length(unlist(result[

[Rd] autogenerated namespaces not initialized correctly

2011-08-11 Thread Michael Lawrence
Hi guys, This probably isn't news, but when a package is given an autogenerated namespace, its .First.lib, if any, is no longer called. This causes problems, e.g., when a package is loading a dynamic library. Probably no good solution here. The initialization routines could be made to call .First.

[Rd] S3 methods in default namespace

2011-08-26 Thread Michael Lawrence
Hi guys, Are there any plans for figuring out potential S3 methods and declaring them with S3method() in the automatic default NAMESPACE? Thanks, Michael [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.e

Re: [Rd] Link between Qt GUI and R

2011-09-12 Thread Michael Lawrence
There are two approaches that I would recommend, depending on your requirements: 1) Write a Qt GUI application and embed R inside of it. Dirk has laid out that solution. 2) Write the Qt GUI in R. Simon kindly mentioned qtgui but that is an obsolete package. You would do this using qtbase, which i

Re: [Rd] S4 inheritance and old class

2015-05-28 Thread Michael Lawrence
On Thu, May 28, 2015 at 2:49 AM, Julien Idé wrote: > Hey everyone, > > I would like to develop a package using S4 classes. > I have to define several S4 classes that inherits from each others as > follow: > > # A <- B <- C <- D > > I also would like to define .DollarNames methods for these class s

Re: [Rd] Improving string concatenation

2015-06-17 Thread Michael Lawrence
Just to clarify, primitive (C-level) generics do not support dispatch on basic classes (like character). This is for performance (no need to consider dispatch on non-objects) and for sanity (in general, redefining fundamental behaviors is dangerous). It is of course possible to define a "+" method

Re: [Rd] Plans to improve reference classes?

2015-06-22 Thread Michael Lawrence
(Moved to R-devel) Niek, Would you please provide the details on this test case, including your benchmarks, and what you are trying to achieve at the high-level? Thanks, Michael On Wed, Jun 17, 2015 at 4:55 AM, Niek Bouman wrote: > Dear R-core team, > > I was wondering whether you have any

Re: [Rd] Plans to improve reference classes?

2015-06-23 Thread Michael Lawrence
w ref classes work) > > Hadley > > On Mon, Jun 22, 2015 at 8:49 AM, Michael Lawrence > wrote: >> (Moved to R-devel) >> >> Niek, >> >> Would you please provide the details on this test case, including your >> benchmarks, and what you are trying to

Re: [Rd] Graphical User Interface (GUI)

2015-07-08 Thread Michael Lawrence
On Wed, Jul 8, 2015 at 11:43 AM, vthokienj wrote: > I'd like to create a user interface for my R code and have only seen mostly > older posts on the subject. > I'm not looking for an IDE for development, but something that the end user > of the software would use. > So something that would involve

Re: [Rd] Mapping parse tree elements to tokens

2015-07-29 Thread Michael Lawrence
Probably need a generic tree based on "ParseNode" objects that associate the line information with the symbol (for leaf nodes). As Duncan notes, it should be possible to gather that from the table. But it would be nice if there was an "expr" column in the parse data column in addition to "text". I

Re: [Rd] Mapping parse tree elements to tokens

2015-07-29 Thread Michael Lawrence
ere one would want a reference from parse node to location. So neither of those involves code evaluation at first glance, though I guess one could use some sort of evaluation during analysis. On Wed, Jul 29, 2015 at 11:47 AM, Duncan Murdoch wrote: > On 29/07/2015 2:30 PM, Michael Lawrence wrote

Re: [Rd] Mapping parse tree elements to tokens

2015-07-29 Thread Michael Lawrence
y do so. I would be wary about committing to this sort of > implementation specific stuff -- we might want to go to completely > different parser technology at tome point, which would be harder if we > committed to these sort of details. > > Best, > > luke > > On Wed, 29 Jul

Re: [Rd] sequence divided by data.frame

2015-08-20 Thread Michael Lawrence
The first two behave as expected for vectors, because they are both (at least implicitly) vectors in that usage. But a data.frame is a tabular structure, so it's not obvious how to recycle it, nor does an implicit coercion to matrix/vector seem justified. Thus, R attempts to "recycle" the vector to

Re: [Rd] Good practice for naming classes, builders, attributes, getters/setters for object composition

2015-11-20 Thread Michael Lawrence
On Fri, Nov 20, 2015 at 12:39 AM, Julien Idé wrote: > Hey everyone, > > I am developing a package and I am wondering if there is a good practice > for naming classes, builders, attributes getters and setters when dealing > with object composition. I know that it is usually a good practice to give

Re: [Rd] override pmin/pmax for my own matrix

2015-12-24 Thread Michael Lawrence
Yes, functions like c, min and max are special cases, as they are primitives. For ordinary functions, you just need to promote them with "..." as the signature: setGeneric("pmax", signature="...") setMethod("pmax", "Class", function(..., na.rm=FALSE) { }) One caveat is that all arguments passed v

Re: [Rd] inconsistency in treatment of USE.NAMES argument

2016-02-11 Thread Michael Lawrence
Changing the vapply() behavior makes sense in principle. I analyzed the CRAN code base using the R parser and found 143 instances of calling vapply with USE.NAMES=FALSE. These would need to be inspected to understand the consequences of the change. For reference: /AzureML/R/datasets.R:226 /BBmisc/

Re: [Rd] unary class union of an S3 class

2016-03-18 Thread Michael Lawrence
On Fri, Mar 18, 2016 at 2:53 PM, Hervé Pagès wrote: > Hi, > > Short story > --- > > setClassUnion("ArrayLike", "array") > > showClass("ArrayLike") # no slot > > setClass("MyArrayLikeConcreteSubclass", > contains="ArrayLike", > representation(stuff="ANY") > ) > > sho

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Michael Lawrence
On Sat, Mar 19, 2016 at 12:10 AM, Hervé Pagès wrote: > On 03/18/2016 03:28 PM, Michael Lawrence wrote: > >> >> On Fri, Mar 18, 2016 at 2:53 PM, Hervé Pagès > <mailto:hpa...@fredhutch.org>> wrote: >> >> Hi, >> >> Short story &g

Re: [Rd] unary class union of an S3 class

2016-03-19 Thread Michael Lawrence
On Sat, Mar 19, 2016 at 4:29 AM, Hervé Pagès wrote: > On 03/19/2016 01:22 AM, Michael Lawrence wrote: > >> >> >> On Sat, Mar 19, 2016 at 12:10 AM, Hervé Pagès > <mailto:hpa...@fredhutch.org>> wrote: >> >> On 03/18/2016 03:28 PM, Michael Lawre

Re: [Rd] for in r-devel

2016-03-19 Thread Michael Lawrence
Thanks for pointing this out. The commit you cite was reverted a couple days later, because we are still thinking about how it should work. While it appears Date would benefit, weird things happen e.g. with POSIXlt and other data structures in the wild. This is due to inconsistency in the behaviors

Re: [Rd] S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment

2016-04-18 Thread Michael Lawrence
Right, the methods package is not attached by default when running R with Rscript. We should probably remove that special case, as it mostly just leads to confusion, but that won't happen immediately. For now, the S4_extends() should probably throw an error when the methods namespace is not loaded

Re: [Rd] S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment

2016-04-19 Thread Michael Lawrence
urce/blob/42ecf5f492a005f5398cbb4c9becd4aa5af9d05c/src/main/objects.c#L258-L265). > > I'm fine with Rscript not loading "methods", as long as everything works > properly with "methods" loaded but not attached. > > > -Kirill > > > > On 19.04.2016 04:10,

Re: [Rd] S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment

2016-04-19 Thread Michael Lawrence
Tue, Apr 19, 2016 at 5:34 AM, Michael Lawrence > wrote: >> >> Not sure why R_has_methods_attached() exists. Maybe Martin could shed >> some light on that. >> >> On Mon, Apr 18, 2016 at 11:50 PM, Kirill Müller >> wrote: >> > Tha

Re: [Rd] S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment

2016-04-19 Thread Michael Lawrence
hout the methods > package being attached? I'm not sure implementation-wise how easy this would > be, but it seems like any time there is an S4 object around, the methods > package should be available to deal with it. > > ~G > > On Tue, Apr 19, 2016 at 7:34 AM, Mich

Re: [Rd] How to find R-Journal: Link is hidden

2016-05-01 Thread Michael Lawrence
Thanks, I am working on fixing this. Something went wrong with the website regeneration. Michael On Sun, May 1, 2016 at 12:52 PM, Spencer Graves wrote: > Hello: > > > > I just failed in my attempts to access R-Journal. "r-project.org" > include a link to "The R Journal" plus another sayin

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

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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] 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] 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] 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
<- 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] 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] 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] 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] 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] 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] 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] 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

  1   2   3   >