Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mget cannot get primitive function like get

Tags:

r

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?

like image 774
lovetl2002 Avatar asked Mar 09 '23 21:03

lovetl2002


1 Answers

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).

like image 70
joran Avatar answered Mar 23 '23 08:03

joran