Open dselivanov opened 9 years ago
Thanks - this is an implication of reduced copying in R 3.1.x. ctapply
re-uses value vectors if they fit (which is the case here since they are progressively shorter) and flags them with NAMED=2
which caused previous R versions to duplicate, but R 3.1.x never copies in list()
anymore even with NAMED=2
so it assigns the same vector every time. Ironically, the fix is to always force a copy which will make this slower in most cases than older versions of R.
FWIW a quick fix for this particular case is to use alist
instead of list
.
Thanks for clarification, very helpful. I didn't imagine that this issue is related to so deep R internals :-)
when FUN =
list()
,ctapply()
works not as expected.