[Rd] M[cbind()] <- assignment with Matrix object loses attributes

2020-08-10 Thread Ben Bolker
  Does this constitute a bug, or is there something I'm missing? assigning sub-elements of a sparse Matrix via M[X]<-..., where X is a 2-column matrix, appears to drop user-assigned attributes. I dug around in the R code for Matrix trying to find the relevant machinery but my brain started to h

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

2020-08-10 Thread John Mount
Forgot the url: https://win-vector.com/2014/05/30/trimming-the-fat-from-glm-models-in-r/ On Aug 10, 2020, at 11:50 AM, John Mount mailto:jmo...@win-vector.com>> wrote: Thank you for your suggestion. I do know how to work around the issue. I usually build a fresh environment as a child of base

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

2020-08-10 Thread John Mount
Thank you for your suggestion. I do know how to work around the issue. I usually build a fresh environment as a child of base-environment and then insurt the weights there. I was just trying to provide an example of the issue. emptyenv() can not be used, as it is needed for the eval (errors out

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

2020-08-10 Thread Duncan Murdoch
On 10/08/2020 1:42 p.m., John Mount wrote: I wish I had started with "I am disappointed that lm() doesn't continue its search for weights into the calling environment" or "the fact that lm() looks only in the formula environment and data frame for weights doesn't seem consistent with how other

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

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

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

2020-08-10 Thread John Mount
I wish I had started with "I am disappointed that lm() doesn't continue its search for weights into the calling environment" or "the fact that lm() looks only in the formula environment and data frame for weights doesn't seem consistent with how other values are treated." But I did not. So I do

Re: [Rd] qnbinom with small size is slow

2020-08-10 Thread Constantin Ahlmann-Eltze via R-devel
Thanks Ben for verifying the issue. It is always reassuring to hear when others can reproduce the problem. I wrote a small patch that fixes the issue (https://github.com/r-devel/r-svn/pull/11): diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c index b313ce56b2..d2e8d98759 100644 --- a/src/nm

[Rd] Typos in file.path documentation.

2020-08-10 Thread Rui Barradas
Hello, R 4.0.2 on Ubuntu 20.04, sessionInfo() below. I believe there are two typos in ?file.path, section Value, 2nd paragraph. 1. There is a close parenthesis missing after Encoding, as it is reading is a bit confusing, I had to backtrack and repeat. 2. I'm not a native language speaker but