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

Commented Issue: Problem with DataFrame dynamic column access [80]

$
0
0
When I run the attached Program.cs as a console app, I get this output:
```
iris rows: 150
iris50 rows: 50
species length: 150
species50 length: 150
iris50["Species"].Length: 50
```

I expected species50 to have length 50. It looks like the first iris object used at the dynamic call site is getting cached and reused for subsequent calls.


Comments: `((dynamic)iris).Species` ``` > RDotNet.dll!RDotNet.DataFrame.GetMetaObject(System.Linq.Expressions.Expression parameter) Line 271 C# ``` then ``` > RDotNet.dll!RDotNet.Dynamic.DataFrameDynamicMeta.BindGetMember(System.Dynamic.GetMemberBinder binder) Line 25 C# ``` ``` call {value(RDotNet.DataFrame).Item["Species"]} System.Linq.Expressions.IndexExpression ``` ``` RDotNet.dll!RDotNet.Vector<RDotNet.DynamicVector>.this[string].get(string name) Line 125 C# ``` however when calling ``` var species50 = (DynamicVector)GetSpecies(iris50); ``` While in the scope of the call: ``` + iris50 ColumnCount = 5; RowCount = 50; RObjectType = List RDotNet.DataFrame ``` Getting in the call stack, it appears that GetMetaObject is not called; a lightweight function is directly called, and visibly the one bulid for the full iris data frame, given the size of the 'this' data frame, 150 instead of the expected 50. ``` > RDotNet.dll!RDotNet.Vector<RDotNet.DynamicVector>.this[string].get(string name) Line 114 C# [Lightweight Function] RDotNet.Tests.dll!RDotNet.DataFrameRowMappingTest.GetSpecies(dynamic iris) Line 49 C# RDotNet.Tests.dll!RDotNet.DataFrameRowMappingTest.TestDataFrameSubsetting() Line 40 C# ``` ``` + this ColumnCount = 5; RowCount = 150; RObjectType = List RDotNet.Vector<RDotNet.DynamicVector> {RDotNet.DataFrame} ```

Viewing all articles
Browse latest Browse all 1634

Trending Articles



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