Re: [Rd] issues with environment handling in model.frame()

2020-05-02 Thread Berry, Charles
> On May 2, 2020, at 5:30 AM, Antoine Fabri wrote: > > Dear all, > > model.frame behaves in a way I don't expect when both its formula and > subset argument are passed through a function call. > See the help page ?formula in particular the section headed 'Environments'. Then look at the

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

2019-03-26 Thread Berry, Charles
In the case of inherits (at least) this seems intended. The help page says: "If the object does not have a class attribute, it has an implicit class..." which I take to mean that if an object does have a class attribute it does not also have an implicit class. The behavior you noted below

[Rd] bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample

2019-03-03 Thread Berry, Charles
When `length( skewed.probs ) > 200' uniform samples are generated in R-devel. R-3.5.1 behaves as expected. `epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced. Chuck > set.seed(123) > > epsilon <- 1e-10 > > ## uniform to 200 then small > p200 <-

Re: [Rd] Puzzle or bug with matrix indexing

2018-08-04 Thread Berry, Charles
> On Aug 4, 2018, at 6:55 AM, David Hugh-Jones wrote: > > I'm not sure why this is happening: > > tmp <- data.frame( > a = letters[1:2], > b=c(TRUE, FALSE), > stringsAsFactors = FALSE > ) > idx <- matrix(c(1, 2, 2, 2), 2, byrow = TRUE) > tmp[idx] > > [1] " TRUE" "FALSE" > >From

Re: [Rd] Model formulas with explicit references

2018-07-21 Thread Berry, Charles
> On Jul 20, 2018, at 3:05 PM, Lenth, Russell V wrote: > > Dear R-Devel, > > I seem to no longer be able to access the bug-reporting system, so am doing > this by e-mail. > > My report concerns models where variables are explicitly referenced (or is it > "dereferenced"?), such as: > >

Re: [Rd] new behavior in model.response

2018-06-27 Thread Berry, Charles
> On Jun 27, 2018, at 3:58 PM, Achim Zeileis wrote: > > On Thu, 28 Jun 2018, Therneau, Terry M., Ph.D. via R-devel wrote: > >> I now understand the issue, which leads to a different and deeper issue >> which is "how to assign a proper length to Surv objects". >> >> > Surv(c(1,2,3),

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

2018-06-08 Thread Berry, Charles
> On Jun 8, 2018, at 2:15 PM, Hadley Wickham wrote: > > On Fri, Jun 8, 2018 at 2:09 PM, Berry, Charles wrote: >> >> >>> On Jun 8, 2018, at 1:49 PM, Hadley Wickham wrote: >>> >>> Hmmm, yes, there must be some special case in the C code

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

2018-06-08 Thread Berry, Charles
> On Jun 8, 2018, at 1:49 PM, Hadley Wickham wrote: > > Hmmm, yes, there must be some special case in the C code to avoid > recycling a length-1 logical vector: Here is a version that (I think) handles Herve's issue of arrays having one or more 0 dimensions. subset_ROW <-

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

2018-06-08 Thread Berry, Charles
> On Jun 8, 2018, at 11:52 AM, Hadley Wickham wrote: > > On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles wrote: >> >> >>> On Jun 8, 2018, at 10:37 AM, Hervé Pagès wrote: >>> >>> Also the TRUEs cause problems if some dimensions are 0: >

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

2018-06-08 Thread Berry, Charles
1,length=10,by=100),TRUE)) and with system.time(for (i in 1:1) subset_ROW4(arr,seq(1,length=10,by=100),FALSE)) Changing the dimensions to c(2^5, 2^7, 4, 4 ) and running something similar also shows equal times. Chuck >> On Fri, Jun 8, 2018 at 10:16 AM, Berry, Ch

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

2018-06-08 Thread Berry, Charles
> On 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? You can use TRUE to fill the subscripts for dimensions 2:nd > > subset_ROW <- function(x, i) { >

Re: [Rd] Understanding the sequence of events when calling the R dpois function

2018-05-31 Thread Berry, Charles
> On May 31, 2018, at 8:25 AM, Jason Serviss wrote: > > Hello all, > > I am trying to get a better understanding of the underlying code for the > stats::dpois function in R and, specifically, what happens under the hood > when it is called. I finally managed to track down the C course at:

[Rd] BUG in .col( c(1, 1) ) ?

2018-05-07 Thread Berry, Charles
I would have expected coercion to an integer vector or at least a complaint that the user did not provide a valid matrix dimension. > .col(c(1,1)) Error in .col(c(1, 1)) : a matrix-like object is required as argument to 'col' > .col(c(1L,1L)) [,1] [1,]1 > sessionInfo() R version

Re: [Rd] issue with model.frame()

2018-05-01 Thread Berry, Charles
> On May 1, 2018, at 1:15 PM, Martin Maechler > wrote: > > What version of R is that ? Sorry. It was 3.4.2. But it doesn't matter, because my diagnosis was wrong even there. I think (based on my reading of my outdated version) the problem is a bit upstream in

Re: [Rd] [EXTERNAL] Re: issue with model.frame()

2018-05-01 Thread Berry, Charles
Unfortunately, I spoke too soon. model.frame calls formula <- terms(formula, data = data) if formula does not inherit from class "terms" as in your case. And that is where the bad terms.labels attribute comes from. So, the fix I suggested won't work. But maybe you can just supply a terms

Re: [Rd] issue with model.frame()

2018-05-01 Thread Berry, Charles
> On May 1, 2018, at 6:11 AM, Therneau, Terry M., Ph.D. via R-devel > wrote: > > A user sent me an example where coxph fails, and the root of the failure is a > case where names(mf) is not equal to the term.labels attribute of the formula > -- the latter has an

Re: [Rd] cat(fill=N)

2018-03-16 Thread Berry, Charles
> On Mar 16, 2018, at 9:19 AM, Serguei Sokol wrote: > > Le 16/03/2018 à 17:10, David Hugh-Jones a écrit : >> Hi all, >> >> I expect I'm getting something wrong, but >> >> cat("foo bar baz foo bar baz foo bar baz", fill = 10) >> >> should be broken into lines of width

Re: [Rd] silent recycling in logical indexing

2018-01-04 Thread Berry, Charles
> On Jan 4, 2018, at 1:44 PM, Ben Bolker wrote: > > Chuck: I don't see how this example represents > incomplete/incommensurate recycling. It doesn't. I took your subject line to be the theme of your posting and `incommensurate lengths' to be an instance used to emphasize

Re: [Rd] silent recycling in logical indexing

2018-01-04 Thread Berry, Charles
> On Jan 4, 2018, at 11:56 AM, Ben Bolker wrote: > > > Sorry if this has been covered here somewhere in the past, but ... > > Does anyone know why logical vectors are *silently* recycled, even > when they are incommensurate lengths, when doing logical indexing? It is