[Rd] eapply duplicates elements unnecessarily

Martin Morgan mtmorgan at fhcrc.org
Mon Feb 10 08:24:33 CET 2014


eapply duplicates the elements of the environment it is being applied to

 > env = new.env(); x = 1; tracemem(x)
[1] "<0x1758cd18>"
 > env[["x"]] = x
 > xx <- eapply(env, length)
tracemem[0x1758cd18 -> 0x1758cbc8]: eapply

but duplication seems unnecessary. I think this is because of 'duplicate' in 
FrameValues (envir.c:2402). It's hard to tell what contract FrameValues is 
living up to, but is  INCREMENT_NAMED() sufficient? (the PROTECT on value in 
line 2398 also seems unnecessary -- it must already be protected?)

Martin
-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the R-devel mailing list