Haan, Stefan
2024-Aug-22 14:03 UTC
[Rd] Make factanal accept functions for rotation parameter
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 -------------- next part -------------- A non-text attachment was scrubbed... Name: patch.diff Type: text/x-patch Size: 568 bytes Desc: patch.diff URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20240822/1e44bee6/attachment.bin>
Martin Maechler
2024-Aug-22 16:09 UTC
[Rd] Make factanal accept functions for rotation parameter
>>>>> 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$loadingsI'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