4

I can use get to get primitive function, like:

get('$') 
.Primitive("$")

However, mget failed:

mget('$')
Error: value for ‘$’ not found

Why? How to fix this?

lovetl2002
  • 910
  • 9
  • 23

1 Answers1

7

The default for get is to use inherits = TRUE (I think, based on the docs, for historical reasons), while the default for mget is inherits = FALSE. So using inherits = TRUE should make it work like get.

If you'd like a really detailed (but also very very good) dive into exactly what's happening here read this. Or just skip to the "Map of the World" section, and remember that $, being a primitive function, is in the environment of the of the base namespace (package:base, essentially).

joran
  • 169,992
  • 32
  • 429
  • 468