is check=FALSE safe in compact()?
0
1
Entering edit mode
robmaz77 ▴ 20
@dc2bd3d5
Last seen 3.8 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 • 855 views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 620 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6