Skip to content
Prev 45216 / 63424 Next

double bracket stripping names

Hi Patrick,
On 02/26/2013 02:30 AM, Patrick Burns wrote:
FWIW, here are a couple of other interesting facts about this:

  (a) [[ is about twice faster than [ for me (64-bit Ubuntu)
      on a named atomic vector.

  (b) [[ raises an error if the subscript is out of bounds:

        > c(a=1, b=2)[3]
        <NA>
          NA

        > c(a=1, b=2)[[3]]
        Error in c(a = 1, b = 2)[[3]] : subscript out of bounds

      Can be useful in some contexts.

Cheers,
H.