Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Closed Issue: Environment.SetSymbol not working as documented [93]

$
0
0
Environment.SetSymbol is documented as a method which "Defines a symbol in this environment." However, the underlying R function (Rf_SetVar) has this comment:

Assign a new value to bound symbol. Note this does the "inherits"
case. I.e. it searches frame-by-frame for a symbol and binds the
given value to the first symbol encountered. If no symbol is
found then a binding is created in the global environment.

I believe Rf_defineVar is the R function which behaves as documented for SetSymbol.

Here is an example showing the current behavior:

var env = engine.Evaluate("list2env(list(a=5))").AsEnvironment();
Console.WriteLine(String.Join(", ", env.GetSymbolNames()));
env.SetSymbol("b", engine.CreateIntegerVector(new int[] { 6 }));
Console.WriteLine(String.Join(", ", env.GetSymbolNames()));
Console.WriteLine(String.Join(", ", engine.GlobalEnvironment.GetSymbolNames()));

outputs:

a
a
b

Comments: Fixed on: Revision: 267 Changeset: 2462aa076658048fde28a34b97352abf4573279e [2462aa076658] Parents: 266 Date: Saturday, 22 March 2014 7:22:29 PM Branch: jperraud

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>