[Rd] Small typo in nlme documentation

2025-01-07 Thread Roland Fuß via R-devel

Hi,

I've noticed a small typo in `help("varClasses", "nlme")`. Contrary to 
what the "Note" says, variance classes need a method for `Initialize` 
(capital i) and not `initialize`.


Best regards,

Roland

--
Dr. Roland Fuß

Thünen-Institut für Agrarklimaschutz/
Thünen Institute of Climate-Smart Agriculture

Bundesallee 65
D-38116 Braunschweig, Germany

Tel./Webex: ++49 531 25701967
Email: roland.f...@thuenen.de

Arbeitsgruppe "Emissionsberichterstattung"/
Working group "Emission Inventories"
Email: emissionsinvent...@thuenen.de

Das Johann Heinrich von Thünen-Institut,
Bundesforschungsinstitut für Ländliche Räume,
Wald und Fischerei – kurz: Thünen-Institut –
besteht aus 15 Fachinstituten, die in den
Bereichen Ökonomie, Ökologie und Technologie
forschen und die Politik beraten.

The Johann Heinrich von Thünen Institute,
Federal Research Institute for Rural Areas,
Forestry and Fisheries – Thünen Institute in brief –
consists of 15 specialized institutes that
carry out research and provide policy advice
in the fields of economy, ecology and technology.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] FR: improve "use" function

2025-05-23 Thread Roland Fuß via R-devel

Hello,

Currently `use` fails silently if you try to attach functions from the 
same namespace. It would be nice and more similiar to the use of 
roxygen2 if it could add (and maybe even remove?) functions. Here is a 
simple proof of concept I have posted on Stack Overflow [1]. Something 
similar could be done within `use`. Of course, it would be preferable if 
it didn't need to detach the namespace.


|use("data.table", "fread") ls("package:data.table") #[1] "fread" 
use("data.table", "nafill") ls("package:data.table") #[1] "fread" 
useplus <- function(package, include.only) { loaded <- 
ls(sprintf("package:%s", package), all.names = TRUE) 
unloadNamespace(package) if (missing(include.only)) { use(package) } 
else { use(package, union(loaded, include.only)) } } 
useplus("data.table", "nafill") ls("package:data.table") #[1] "fread" 
"nafill"|



[1] https://stackoverflow.com/q/79633064/1412059

--
Dr. Roland Fuß

Thünen-Institut für Agrarklimaschutz/
Thünen Institute of Climate-Smart Agriculture

Bundesallee 65
D-38116 Braunschweig, Germany

Tel./Webex: ++49 531 25701967
Email: roland.f...@thuenen.de

Arbeitsgruppe "Emissionsberichterstattung"/
Working group "Emission Inventories"
Email: emissionsinvent...@thuenen.de

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] FR: improve "use" function

2025-06-04 Thread Roland Fuß via R-devel
As a user I would prefer:

A (classed) error if I ask for something impossible.

A (classed) warning if 'include.only' is handled as 'include' (because I might 
rely on the .only part for some reason and have forgotten that I have already 
attached the namespace).


- Ursprüngliche Mail -
> Von: "Kurt Hornik" 
> An: "Laurent Gatto" 
> CC: "Kurt Hornik" , "Trevor Davis" 
> , r-devel@r-project.org, "roland
> fuss" 
> Gesendet: Dienstag, 3. Juni 2025 19:23:01
> Betreff: Re: [Rd] FR: improve "use" function

>> Laurent Gatto writes:
> 
> Thanks.
> 
> In general, I guess we all agree that if 'include.only' or 'exclude' ask
> for something (currently) impossible then a suitably classed condition
> object should be thrown.  Could be both a warning or an error ...
> 
> And perhaps we should take 'include.only' as 'include', i.e., be fine
> when we give 'include.only' as a subset of what is already included.
> 
> Personally, I am not a big fan of suggesting to use detach() in the
> condition message.
> 
> Best
> -k
> 
>> On Tuesday, May 27th, 2025 at 9:13 AM, Kurt Hornik  
>> wrote:
>>> > > > > > Trevor Davis writes:
>>> 
>>> 
>>> Thanks.
>>> 
>>> This is really about what
>>> 
>>> library("foo", include.only = "fun2")
>>> 
>>> should do if package 'foo' was already attached and the include.only
>>> contradicts a previous specification.
>>> 
>>> In principle, one could look into allowing the underlying
>>> attachNamespace() to add more exports into the package environment (the
>>> 'only' in 'include.only' might suggest differently, but we would have to
>>> live with that). However, using detach/attach is not the right way of
>>> doing this, as it possibly modifies the search path and may trigger
>>> hooks that should not be triggered. Doing it right would probably need
>>> an .Internal and hence be a lot of work ...
>>> 
>>> What definitely needs attention is the fact that currently the above is
>>> silently ignored. So at least for now we should teach attachNamespace()
>>> to throw a suitably classed error if called with include.only that
>>> contradicts a previous specification.
>>> 
>>> Contributions welcome :-)
> 
>> Some work has been done on that front during last week's r-dev-day
>> with Ella Kaye and Philippe Grosjean [1]. After some more thinking, I
>> think we haven't been stringent enough, and would suggest that the
>> user should be alerted as soon as what they want to attach doesn't
>> match exactly what is already on the search path. Something along the
>> lines of (the warning/message can of course be amended).
> 
>> These two situations are OK, given that exactly the same set is asked
>> for repeated, either with a limited set of functions:
> 
>>> library("Matrix", include.only = "isDiagonal")
>>> library("Matrix", include.only = "isDiagonal") ## ok
> 
>> or, in a new session, with the whole package:
> 
>>> library("Matrix", include.only = "isDiagonal")
>>> library("Matrix", include.only = "isDiagonal") ## ok
> 
>> Below, (again, in a new session) the user could be mislead that either
>> only qr would be attached (and isDiagonal not anymore), or all
>> Matrix's exported symbols:
> 
>>> library("Matrix", include.only = "isDiagonal")
>>> library("Matrix", include.only = "qr") ## warn
>> Warning message:
>> In library("Matrix", include.only = "qr") :
>>   The package 'Matrix' is already loaded with a different set of functions. 
>> Please
>>   detach() it first.
>>> library("Matrix") ## warn
>> Warning message:
>> In library("Matrix") :
>>   The package 'Matrix' is already loaded with a different set of functions. 
>> Please
>>   detach() it first.
> 
>> In the following cases, a subset is asked after all symbols are
>> attached, which also triggers a warning/message:
> 
>>> library("Matrix")
>>> library("Matrix", exclude = "isDiagonal") ## warn
>> Warning message:
>> In library("Matrix", exclude = "isDiagonal") :
>>   The package 'Matrix' is already loaded with a different set of functions. 
>> Please
>>   detach() it first.
>>> library("Matrix", include.only = "isDiagonal") ## warn
>> Warning message:
>> In library("Matrix", include.only = "isDiagonal") :
>>   The package 'Matrix' is already loaded with a different set of functions. 
>> Please
>>   detach() it first.
> 
>> If this is a good way forward, I would be happy to carry on that work.
> 
>> Laurent
> 
> 
> > [1] https://github.com/r-devel/r-dev-day/issues/48

-- 
Thünen-Institut für Agrarklimaschutz/
Thünen Institute of Climate-Smart Agriculture

Bundesallee 65
D-38116 Braunschweig, Germany

Tel./Webex: +49 531 25701967

Email: roland.f...@thuenen.de

Arbeitsgruppe "Emissionsberichterstattung"/
Working group "Emission Inventories"
Email: emissionsinvent...@thuenen.de

Das Johann Heinrich von Thünen-Institut, 
Bundesforschungsinstitut für Ländliche Räume, 
Wald und Fischerei – kurz: Thünen-Institut – 
besteht aus 15 Fachinstituten, die über 
sozioökonomische, ökologische und technologische 
Kompetenz verfügen. Das Thünen-Institut be

[Rd] Clarify documentation of nlme::varIdent

2025-09-19 Thread Roland Fuß via R-devel

Hello,

The documentation of nlme::varIdent says this:

"the coefficients of the variance function represent the ratios between 
the variances and a reference variance (corresponding to a reference 
group level)"


However, the parameter estimate shown in the summary output for lme 
models is the ratio between standard deviations. Could this be clarified 
in the documentation, e.g., by adding Eq. 5.13 from Pinheiro and Bates 
(2000)?


--
Dr. Roland Fuß

Thünen-Institut für Agrarklimaschutz/
Thünen Institute of Climate-Smart Agriculture

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel