is check=FALSE safe in compact()?
Entering edit mode
robmaz77 ▴ 20
Last seen 3.3 years ago

The "check" option of compact(), TRUE by default, is per ?compact just passed on to "slot<-". The "slot" help says:

check In the replacement version of slot, a flag. If TRUE, check the assigned value for validity as the value of this slot. User's coded should not set this to FALSE in normal use, since the resulting object can be invalid.

but compact() is not really user code, and presumably knows what it assigns? Seems more like a debug option that can maybe be disabled once this has been tried out with a type of object? Background: compact(obj) seems to take ~1s for an obj with a lot of hidden stuff, and I'm doing it many times, so I'm wondering whether this would be an easy way to shave off some runtime.

XVector • 744 views
Entering edit mode

I think it's safe in this circumstance to set it to FALSE; this is likely a significant speed-up.


Login before adding your answer.

Traffic: 426 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6