예제 #1
0
        public async Task MatrixLargeCellTest()
        {
            var script      = "matrix.largecell <- matrix(list(as.double(1:5000), 2, 3, 4), nrow = 2, ncol = 2);";
            var expectation = new VariableExpectation()
            {
                Name = "matrix.largecell", Value = "List of 4", TypeName = "list", Class = "matrix", HasChildren = true, CanShowDetail = true
            };

            using (var hostScript = new VariableRHostScript()) {
                var evaluation = (VariableViewModel)await hostScript.EvaluateAndAssert(
                    script,
                    expectation,
                    VariableRHostScript.AssertEvaluationWrapper);

                Range rowRange    = new Range(0, 1);
                Range columnRange = new Range(0, 1);
                var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.RowHeader.Range.Should().Be(rowRange);
                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));

                grid.Grid[0, 0].Should().Be("1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27...");
            }
        }
예제 #2
0
        public async Task MatrixNATest()
        {
            var script      = "matrix.na.header <- matrix(c(1, 2, 3, 4, NA, NaN, 7, 8, 9, 10), 2, 5, dimnames = list(r = c('r1', NA), c = c('a', 'b', NA, 'd', NA)))";
            var expectation = new VariableExpectation()
            {
                Name = "matrix.na.header", Value = "num [1:2, 1:5] 1 2 3 4 NA NaN 7 8 9 10", TypeName = "double", Class = "matrix", HasChildren = true, CanShowDetail = true
            };

            var evaluation = (VariableViewModel)await _hostScript.EvaluateAndAssert(
                script,
                expectation,
                VariableRHostScript.AssertEvaluationWrapper);

            Range rowRange    = new Range(0, 2);
            Range columnRange = new Range(2, 3);
            var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

            grid.ColumnHeader.Range.Should().Be(columnRange);
            grid.ColumnHeader[2].Should().Be("[,1]");
            grid.ColumnHeader[3].Should().Be("d");
            grid.ColumnHeader[4].Should().Be("[,3]");

            grid.RowHeader.Range.Should().Be(rowRange);
            grid.RowHeader[0].Should().Be("r1");
            grid.RowHeader[1].Should().Be("[2,]");

            grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
            grid.Grid[0, 2].Should().Be("NA");
            grid.Grid[0, 3].Should().Be("7");
            grid.Grid[0, 4].Should().Be("9");
            grid.Grid[1, 2].Should().Be("NaN");
            grid.Grid[1, 3].Should().Be("8");
            grid.Grid[1, 4].Should().Be("10");
        }
예제 #3
0
        public async Task MatrixOnlyColumnNameTest()
        {
            var script      = "matrix.colname.na <- matrix(1:6, nrow=2, ncol=3);colnames(matrix.colname.na)<-c('col1',NA,'col3');";
            var expectation = new VariableExpectation()
            {
                Name = "matrix.colname.na", Value = "int [1:2, 1:3] 1 2 3 4 5 6", TypeName = "integer", Class = "matrix", HasChildren = true, CanShowDetail = true
            };

            var evaluation = (VariableViewModel)await _hostScript.EvaluateAndAssert(
                script,
                expectation,
                VariableRHostScript.AssertEvaluationWrapper);

            Range rowRange    = new Range(0, 2);
            Range columnRange = new Range(0, 3);
            var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

            grid.ColumnHeader.Range.Should().Be(columnRange);
            grid.ColumnHeader[0].Should().Be("col1");
            grid.ColumnHeader[1].Should().Be("[,2]");
            grid.ColumnHeader[2].Should().Be("col3");

            grid.RowHeader.Range.Should().Be(rowRange);
            grid.RowHeader[0].Should().Be("[1,]");
            grid.RowHeader[1].Should().Be("[2,]");

            grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
            grid.Grid[0, 0].Should().Be("1");
            grid.Grid[0, 1].Should().Be("3");
            grid.Grid[0, 2].Should().Be("5");
            grid.Grid[1, 0].Should().Be("2");
            grid.Grid[1, 1].Should().Be("4");
            grid.Grid[1, 2].Should().Be("6");
        }
예제 #4
0
        private async Task PreviewContentAsync()
        {
            if (string.IsNullOrEmpty(FilePathBox.Text))
            {
                return;
            }

            int cp = GetSelectedValueAsInt(EncodingComboBox);

            PreviewFileContent(FilePathBox.Text, cp);
            await ConvertToUtf8(FilePathBox.Text, cp, false, MaxPreviewLines);

            if (!string.IsNullOrEmpty(_utf8FilePath))
            {
                var expression = BuildCommandLine(preview: true);
                if (expression != null)
                {
                    try {
                        var grid = await GridDataSource.GetGridDataAsync(expression, null);

                        PopulateDataFramePreview(grid);
                        DataFramePreview.Visibility = Visibility.Visible;
                    } catch (Exception ex) {
                        OnError(ex.Message);
                    }
                }
            }
        }
예제 #5
0
        public async Task DataFrameLangTest()
        {
            var script      = "df.lang <- data.frame(col1=c('a','中'),col2=c('國','d'),row.names = c('マイクロソフト','row2'));";
            var expectation = new VariableExpectation()
            {
                Name = "df.lang", Value = "2 obs. of  2 variables", TypeName = "list", Class = "data.frame", HasChildren = true, CanShowDetail = true
            };

            using (var hostScript = new VariableRHostScript()) {
                var evaluation = (VariableViewModel)await hostScript.EvaluateAndAssert(
                    script,
                    expectation,
                    VariableRHostScript.AssertEvaluationWrapper);

                Range rowRange    = new Range(0, 2);
                Range columnRange = new Range(0, 2);
                var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.ColumnHeader[0].Should().Be("col1");
                grid.ColumnHeader[1].Should().Be("col2");

                grid.RowHeader.Range.Should().Be(rowRange);
                grid.RowHeader[0].Should().Be("マイクロソフト");
                grid.RowHeader[1].Should().Be("row2");

                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
                grid.Grid[0, 0].Should().Be("a");
                grid.Grid[0, 1].Should().Be("國");
                grid.Grid[1, 0].Should().Be("中");
                grid.Grid[1, 1].Should().Be("d");
            }
        }
예제 #6
0
        private async Task PreviewContentAsync()
        {
            if (string.IsNullOrEmpty(FilePathBox.Text))
            {
                return;
            }

            var cp = GetSelectedValueAsInt(EncodingComboBox);

            PreviewFileContent(FilePathBox.Text, cp);
            await ConvertToUtf8(FilePathBox.Text, cp, false, MaxPreviewLines);

            if (!string.IsNullOrEmpty(_utf8FilePath))
            {
                var expression = BuildCommandLine(preview: true);
                if (expression != null)
                {
                    try {
                        var session = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate().RSession;
                        var ds      = new GridDataSource(session);
                        var grid    = await ds.GetGridDataAsync(expression, null);

                        PopulateDataFramePreview(grid);
                        DataFramePreview.Visibility = Visibility.Visible;
                    } catch (Exception ex) {
                        OnError(ex.Message);
                    }
                }
            }
        }
예제 #7
0
        public async Task MatrixOnlyRowNameTest()
        {
            var script      = "matrix.rowname.na <- matrix(c(1,2,3,4), nrow=2, ncol=2);rownames(matrix.rowname.na)<-c(NA, 'row2');";
            var expectation = new VariableExpectation()
            {
                Name = "matrix.rowname.na", Value = "num [1:2, 1:2] 1 2 3 4", TypeName = "double", Class = "matrix", HasChildren = true, CanShowDetail = true
            };

            using (var hostScript = new VariableRHostScript()) {
                var evaluation = (VariableViewModel)await hostScript.EvaluateAndAssert(
                    script,
                    expectation,
                    VariableRHostScript.AssertEvaluationWrapper);

                Range rowRange    = new Range(0, 2);
                Range columnRange = new Range(0, 2);
                var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.ColumnHeader[0].Should().Be("[,1]");
                grid.ColumnHeader[1].Should().Be("[,2]");

                grid.RowHeader.Range.Should().Be(rowRange);
                grid.RowHeader[0].Should().Be("NA");
                grid.RowHeader[1].Should().Be("row2");

                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
                grid.Grid[0, 0].Should().Be("1");
                grid.Grid[0, 1].Should().Be("3");
                grid.Grid[1, 0].Should().Be("2");
                grid.Grid[1, 1].Should().Be("4");
            }
        }
예제 #8
0
        public async Task MatrixNamedTest()
        {
            var script      = "matrix.named <- matrix(1:10, 2, 5, dimnames = list(r = c('r1', 'r2'), c = c('a', 'b', 'c', 'd', 'e')))";
            var expectation = new VariableExpectation()
            {
                Name = "matrix.named", Value = "int [1:2, 1:5] 1 2 3 4 5 6 7 8 9 10", TypeName = "integer", Class = "matrix", HasChildren = true, CanShowDetail = true
            };

            var evaluation = (VariableViewModel)await _hostScript.EvaluateAndAssert(
                script,
                expectation,
                VariableRHostScript.AssertEvaluationWrapper);

            Range rowRange    = new Range(0, 2);
            Range columnRange = new Range(2, 3);
            var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

            grid.ColumnHeader.Range.Should().Be(columnRange);
            grid.ColumnHeader[2].Should().Be("c");
            grid.ColumnHeader[3].Should().Be("d");
            grid.ColumnHeader[4].Should().Be("e");

            grid.RowHeader.Range.Should().Be(rowRange);
            grid.RowHeader[0].Should().Be("r1");
            grid.RowHeader[1].Should().Be("r2");

            grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
            grid.Grid[0, 2].Should().Be("5");
            grid.Grid[0, 3].Should().Be("7");
            grid.Grid[0, 4].Should().Be("9");
            grid.Grid[1, 2].Should().Be("6");
            grid.Grid[1, 3].Should().Be("8");
            grid.Grid[1, 4].Should().Be("10");
        }
예제 #9
0
        public Task <IGridData <string> > GetAsync(GridRange gridRange)
        {
            var t = GridDataSource.GetGridDataAsync(_evaluation.Expression, gridRange);

            if (t == null)
            {
                // May happen when R host is not running
                Trace.Fail(Invariant($"{nameof(EvaluationWrapper)} returned null grid data"));
                return(Task.FromResult <IGridData <string> >(null));
            }
            return(t);
        }
예제 #10
0
        public async Task DataFrameTest()
        {
            var script      = "df.test <- data.frame(101:103, c('\"a', 'b', 'c'))";
            var expectation = new VariableExpectation()
            {
                Name = "df.test", Value = "3 obs. of  2 variables", TypeName = "list", Class = "data.frame", HasChildren = true, CanShowDetail = true
            };

            using (var hostScript = new VariableRHostScript()) {
                var evaluation = (VariableViewModel)await hostScript.EvaluateAndAssert(
                    script,
                    expectation,
                    VariableRHostScript.AssertEvaluationWrapper);

                Range rowRange    = new Range(0, 3);
                Range columnRange = new Range(0, 2);
                var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.ColumnHeader[0].Should().Be("X101.103");
                grid.ColumnHeader[1].Should().Be("c....a....b....c..");

                grid.RowHeader.Range.Should().Be(rowRange);
                grid.RowHeader[0].Should().Be("1");
                grid.RowHeader[1].Should().Be("2");
                grid.RowHeader[2].Should().Be("3");

                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
                grid.Grid[0, 0].Should().Be("101");
                grid.Grid[0, 1].Should().Be("\"a");
                grid.Grid[1, 0].Should().Be("102");
                grid.Grid[1, 1].Should().Be("b");
                grid.Grid[2, 0].Should().Be("103");
                grid.Grid[2, 1].Should().Be("c");

                // single column
                columnRange = new Range(1, 1);
                grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.ColumnHeader[1].Should().Be("c....a....b....c..");

                grid.RowHeader.Range.Should().Be(rowRange);
                grid.RowHeader[0].Should().Be("1");
                grid.RowHeader[1].Should().Be("2");
                grid.RowHeader[2].Should().Be("3");

                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
                grid.Grid[0, 1].Should().Be("\"a");
                grid.Grid[1, 1].Should().Be("b");
                grid.Grid[2, 1].Should().Be("c");
            }
        }
예제 #11
0
        public async Task Matrix10x100Test()
        {
            var script      = "matrix.10x100 <-matrix(1:1000, 10, 100)";
            var expectation = new VariableExpectation()
            {
                Name          = "matrix.10x100",
                Value         = "int [1:10, 1:100] 1 2 3 4 5 6 7 8 9 10 ...",
                TypeName      = "integer",
                Class         = "matrix",
                HasChildren   = true,
                CanShowDetail = true
            };

            var evaluation = (VariableViewModel)await _hostScript.EvaluateAndAssert(
                script,
                expectation,
                VariableRHostScript.AssertEvaluationWrapper);

            var rowRange    = new Range(0, 2);
            var columnRange = new Range(1, 3);
            var grid        = await _dataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

            grid.ColumnHeader.Range.Should().Be(columnRange);
            grid.ColumnHeader[1].Should().Be("V2");
            grid.ColumnHeader[2].Should().Be("V3");
            grid.ColumnHeader[3].Should().Be("V4");

            grid.RowHeader.Range.Should().Be(rowRange);
            grid.RowHeader[0].Should().Be("1");
            grid.RowHeader[1].Should().Be("2");

            grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
            grid.Grid[0, 1].Should().Be("11");
            grid.Grid[0, 2].Should().Be("21");
            grid.Grid[0, 3].Should().Be("31");
            grid.Grid[1, 1].Should().Be("12");
            grid.Grid[1, 2].Should().Be("22");
            grid.Grid[1, 3].Should().Be("32");
        }
예제 #12
0
        private async Task PreviewAsync()
        {
            var expression = BuildCommandLine(true);

            if (expression != null)
            {
                try {
                    var grid = await GridDataSource.GetGridDataAsync(expression, null);

                    PopulateDataFramePreview(grid);
                    OnSuccess(true);
                } catch (Exception ex) {
                    OnError(ex.Message);
                }
            }
        }
예제 #13
0
        private static void FetchChunk(string expression, int start, int chunkSize, ExcelData xlData, int totalRows, int totalCols)
        {
            IGridData <string> data =
                GridDataSource.GetGridDataAsync(expression,
                                                new GridRange(new Range(start, Math.Min(chunkSize, totalRows - start)),
                                                              new Range(0, totalCols))).Result;

            if (data != null)
            {
                if (data.RowHeader != null)
                {
                    if (xlData.RowNames == null)
                    {
                        xlData.RowNames = new object[totalRows];
                    }
                    for (int r = 0; r < chunkSize && r < totalRows - start; r++)
                    {
                        xlData.RowNames[r + start] = data.RowHeader[r + start];
                    }
                }

                if (data.ColumnHeader != null && xlData.ColNames == null)
                {
                    xlData.ColNames = new object[totalCols];
                    for (int c = 0; c < totalCols; c++)
                    {
                        xlData.ColNames[c] = data.ColumnHeader[c];
                    }
                }

                for (int r = 0; r < chunkSize && r < totalRows - start; r++)
                {
                    for (int c = 0; c < totalCols; c++)
                    {
                        xlData.CellData[r + start, c] = data.Grid[r + start, c];
                    }
                }
            }
        }
예제 #14
0
        public async Task Matrix10x100Test()
        {
            var script      = "matrix.10x100 <-matrix(1:1000, 10, 100)";
            var expectation = new VariableExpectation()
            {
                Name = "matrix.10x100", Value = "int [1:10, 1:100] 1 2 3 4 5 6 7 8 9 10 ...", TypeName = "integer", Class = "matrix", HasChildren = true, CanShowDetail = true
            };

            using (var hostScript = new VariableRHostScript()) {
                var evaluation = (EvaluationWrapper)await hostScript.EvaluateAndAssert(
                    script,
                    expectation,
                    VariableRHostScript.AssertEvaluationWrapper);

                Range rowRange    = new Range(0, 2);
                Range columnRange = new Range(1, 3);
                var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.ShouldBeEquivalentTo(columnRange);
                grid.ColumnHeader[1].ShouldBeEquivalentTo("[,2]");
                grid.ColumnHeader[2].ShouldBeEquivalentTo("[,3]");
                grid.ColumnHeader[3].ShouldBeEquivalentTo("[,4]");

                grid.RowHeader.Range.ShouldBeEquivalentTo(rowRange);
                grid.RowHeader[0].ShouldBeEquivalentTo("[1,]");
                grid.RowHeader[1].ShouldBeEquivalentTo("[2,]");

                grid.Grid.Range.ShouldBeEquivalentTo(new GridRange(rowRange, columnRange));
                grid.Grid[0, 1].ShouldBeEquivalentTo("11");
                grid.Grid[0, 2].ShouldBeEquivalentTo("21");
                grid.Grid[0, 3].ShouldBeEquivalentTo("31");
                grid.Grid[1, 1].ShouldBeEquivalentTo("12");
                grid.Grid[1, 2].ShouldBeEquivalentTo("22");
                grid.Grid[1, 3].ShouldBeEquivalentTo("32");
            }
        }
예제 #15
0
        /// <summary>
        /// Runs <c>rtvs:::grid_data</c> for <paramref name="expression"/>, and validates that
        /// returned data matches expectations.
        /// </summary>
        /// <param name="expression">Expression to produce a data structure to retrieve grid data from.</param>
        /// <param name="firstRow">First row which should be retrieved; 1-based (as in R).</param>
        /// <param name="firstColumn">First column that should be retrieved; 1-based (as in R).</param>
        /// <param name="expected">
        /// Expected values. This is a 2D array of strings.
        /// Element at <c>[0, 0]</c> must be <see langword="null"/>.
        /// Elements at <c>[0, 1]</c>, <c>[0, 2]</c> etc specify expected column names.
        /// Elements at <c>[1, 0]</c>, <c>[2, 0]</c> etc specify expected row names.
        /// All other elements specify expected values in the corresponding grid cells.
        /// </param>
        /// <param name="sort">
        /// Indices of columns that the data should be sorted on; 1-based (as in R).
        /// A positive value indicates that the corresponding column should be sorted in ascending order.
        /// A negative value indicates that the corresponding column should be sorted in descending order.
        /// If <see langword="null"/>, no sorting is done.
        /// </param>
        /// <remarks>
        /// <para>
        /// The number of rows and columns that are fetched is the same as the number of elements
        /// in <paramref name="expected"/>, not counting the row and column headers. For example,
        /// if <paramref name="expected"/> is a 3x4 array, a 2x3 slice is fetched, with the top left
        /// corner specified by <paramref name="firstRow"/> and <paramref name="firstColumnt"/>.
        /// </para>
        /// <para>
        /// <c>rtvs:::grid_data</c> sorts the entire dataset first, and only then slices it.
        /// </para>
        /// <remarks>
        private async Task Test(
            string expression,
            int firstRow,
            int firstColumn,
            string[,] expected,
            int[] sort = null
            )
        {
            int height = expected.GetUpperBound(0) + 1;
            int width  = expected.GetUpperBound(1) + 1;

            height.Should().BeGreaterOrEqualTo(1);
            width.Should().BeGreaterOrEqualTo(1);
            expected[0, 0].Should().BeNull();

            var expectedRowHeaders = new List <string>();

            for (int y = 1; y < height; ++y)
            {
                expectedRowHeaders.Add(expected[y, 0]);
            }

            var expectedColumnHeaders = new List <string>();

            for (int x = 1; x < width; ++x)
            {
                expectedColumnHeaders.Add(expected[0, x]);
            }

            var expectedValues = new string[height - 1, width - 1];

            for (int y = 1; y < height; ++y)
            {
                for (int x = 1; x < width; ++x)
                {
                    expectedValues[y - 1, x - 1] = expected[y, x];
                }
            }

            var range = new GridRange(
                new Range(firstRow - 1, expectedRowHeaders.Count),
                new Range(firstColumn - 1, expectedColumnHeaders.Count));

            SortOrder order = null;

            if (sort != null)
            {
                order = new SortOrder();
                foreach (var x in sort)
                {
                    order.Add(new ColumnSortOrder(Math.Abs(x) - 1, x < 0));
                }
            }

            var data = await GridDataSource.GetGridDataAsync(_session, expression, range, order);

            ToEnumerable(data.RowHeader).Should().Equal(expectedRowHeaders);
            ToEnumerable(data.ColumnHeader).Should().Equal(expectedColumnHeaders);

            data.Grid.Range.Rows.Count.Should().Be(expectedRowHeaders.Count);
            data.Grid.Range.Columns.Count.Should().Be(expectedColumnHeaders.Count);

            ShouldEqual(data.Grid, expectedValues);
        }
예제 #16
0
 public Task <IGridData <string> > GetAsync(GridRange gridRange, ISortOrder sortOrder = null)
 => _dataSource.GetGridDataAsync(_dataObject.Expression, gridRange, sortOrder);
예제 #17
0
        public async Task MatrixOneRowColumnTest()
        {
            var script1      = "matrix.singlerow <- matrix(1:3, nrow=1);";
            var expectation1 = new VariableExpectation()
            {
                Name          = "matrix.singlerow",
                Value         = "int [1, 1:3] 1 2 3",
                TypeName      = "integer",
                Class         = "matrix",
                HasChildren   = true,
                CanShowDetail = true
            };

            var script2      = "matrix.singlecolumn <- matrix(1:3, ncol=1);";
            var expectation2 = new VariableExpectation()
            {
                Name          = "matrix.singlecolumn",
                Value         = "int [1:3, 1] 1 2 3",
                TypeName      = "integer",
                Class         = "matrix",
                HasChildren   = true,
                CanShowDetail = true
            };

            using (var hostScript = new VariableRHostScript()) {
                var evaluation = (VariableViewModel)await hostScript.EvaluateAndAssert(
                    script1,
                    expectation1,
                    VariableRHostScript.AssertEvaluationWrapper);

                Range rowRange    = new Range(0, 1);
                Range columnRange = new Range(0, 3);
                var   grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.ColumnHeader[0].Should().Be("[,1]");
                grid.ColumnHeader[1].Should().Be("[,2]");
                grid.ColumnHeader[2].Should().Be("[,3]");

                grid.RowHeader.Range.Should().Be(rowRange);
                grid.RowHeader[0].Should().Be("[1,]");

                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
                grid.Grid[0, 0].Should().Be("1");
                grid.Grid[0, 1].Should().Be("2");
                grid.Grid[0, 2].Should().Be("3");


                evaluation = (VariableViewModel)await hostScript.EvaluateAndAssert(
                    script2,
                    expectation2,
                    VariableRHostScript.AssertEvaluationWrapper);

                rowRange    = new Range(0, 3);
                columnRange = new Range(0, 1);
                grid        = await GridDataSource.GetGridDataAsync(evaluation.Expression, new GridRange(rowRange, columnRange));

                grid.ColumnHeader.Range.Should().Be(columnRange);
                grid.ColumnHeader[0].Should().Be("[,1]");

                grid.RowHeader.Range.Should().Be(rowRange);
                grid.RowHeader[0].Should().Be("[1,]");
                grid.RowHeader[1].Should().Be("[2,]");
                grid.RowHeader[2].Should().Be("[3,]");

                grid.Grid.Range.Should().Be(new GridRange(rowRange, columnRange));
                grid.Grid[0, 0].Should().Be("1");
                grid.Grid[1, 0].Should().Be("2");
                grid.Grid[2, 0].Should().Be("3");
            }
        }