[Rd] Make factanal accept functions for rotation parameter

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Thu Aug 22 18:09:45 CEST 2024


>>>>> Haan, Stefan via R-devel 
>>>>>     on Thu, 22 Aug 2024 14:03:09 +0000 writes:

    > Dear R developers,
    > Would it be possible to make `factanal` to also accept functions and
    > not just function names for its `rotation` parameter? If I understand
    > correctly, `do.call` also supports this.

    > Best greetings,
    > Stefan

> Index: src/library/stats/R/factanal.R
> ===================================================================
> --- src/library/stats/R/factanal.R	(revision 87038)
> +++ src/library/stats/R/factanal.R	(working copy)
> @@ -137,7 +137,7 @@
>                        "unable to optimize from these starting values"),
>               domain = NA)
>      load <- fit$loadings
> -    if(rotation != "none") {
> +    if(rotation != "none" || is.function(rotation)) {
>          rot <- do.call(rotation, c(list(load), cn$rotate))
>          load <- if (is.list(rot)) {
>            load <- rot$loadings

I'm not a factanal user myself, but I think this is a very good,
even "obvious" (in hindsight)  suggestion.
.... unless I'm forgetting something.

Can you please provide useful (but *small*) example,  which I
then also could add to the help page ?

Best regards,
Martin

--
Martin Maechler
ETH Zurich  and   R Core team



More information about the R-devel mailing list