Row Selection and the Filtered Data Tab

MIDAS shares the row selection among the tabs that show the same dataset.1

When you replace the selection by clicking a graph element or a Crosstab cell, MIDAS records a condition that represents the selected rows. MIDAS also records a condition when you put a graph in Select mode and replace the selection by dragging over a range. With this condition, you can show the selected rows as a table in the Filtered Data tab, or save them as a Derived Dataset. A saved Derived Dataset filters rows with the same condition as the Filtered Data tab, so each time the dataset that the Filtered Data tab filters is updated, MIDAS rebuilds the Derived Dataset from the new data.

Sharing the Selection

Tabs that show the same dataset show the same selection, even when they are in different workspaces.

You select rows by clicking, or by dragging on a graph in Select mode. You can click graph elements, cross tabulation cells, Most frequent counts, and table rows in the Data Table and Filtered Data tabs. On this page, cross tabulation refers collectively to the Crosstab tab, Crosstab elements in reports, and the cross tabulations in the Statistics and Selected Columns tabs. Most frequent counts appear in the Statistics and Selected Columns tabs and in statistics summaries added to a report. The operations in each tab are described on the Data Table, Statistics, and Graph Builder pages.

Graph elements, cross tabulation cells, and Most frequent counts all select rows by clicking in the same way. When you click one, MIDAS replaces the selection with the rows the element represents. When you click while holding Ctrl/Cmd, MIDAS removes those rows from the selection if all of them are selected, and adds them to the selection otherwise. When you click while holding Shift, MIDAS replaces the selection, as it does for a click without Shift.

The Statistics and Selected Columns tabs have no dataset of their own and show the selection of the active dataset. For example, if you bring a Data Table tab for another dataset to the front of the active pane, the Statistics and Selected Columns tabs show the selection of that dataset.

Each dataset has its own selection, and MIDAS does not carry the selection of one dataset over to another dataset. For example, selecting rows in the Data Table of a Primary Dataset does not highlight the corresponding rows in a Graph Builder tab that shows a Derived Dataset created from that Primary Dataset. The Filtered Data tab shows a dataset that only the tab holds, so a selection in the Filtered Data tab is separate from the selection of the dataset the tab filters. The exceptions are graphs whose Select & drill down on in Graph Builder specifies another dataset, and graphs in analysis tabs whose rows correspond to the rows of the dataset used for the analysis.

When you select rows in a graph listed as an exception in the previous paragraph, MIDAS also selects the corresponding rows of another dataset. For a graph with Select & drill down on, MIDAS selects the rows of the specified dataset that were used to create the selected rows. For a graph in an analysis tab, MIDAS selects the rows of the dataset used for the analysis that are the same observations as the selected points. For example, when you select a point in a GLM diagnostic plot, the Data Table tab of the dataset the model was fitted to highlights the row of that observation.

MIDAS clears the selection when you reopen the project, and when you update a dataset by reloading, Edit Data, or row exclusion. When you update a dataset, MIDAS also clears the selection of the Derived Datasets that depend on it. MIDAS clears the selection even when the reloaded values are the same as before.

Selection Conditions

Each graph element, cross tabulation cell, and Most frequent count corresponds to one condition and represents the rows that satisfy it. For example, in a bar chart of the values of the species column, the Adelie bar corresponds to the condition species = 'Adelie'.

A range enclosed by dragging in Select mode corresponds to a condition that joins, with AND, one condition per axis: the representative value of the element that contains the row falls in the range. The representative value is the value that the stat and the position output. On an axis of points without a stat, it is the column value. On an axis of a quantity that a stat computes, such as a mean or a count, it is the value that a stat function returns. The representative value of a stacked bar is the upper end of its segment, and that of the x axis of a histogram is the center of the bin. In a box plot, the representative value of the rows in a box is the median of the group, and that of the row of a point beyond the whiskers is the value of the row. On a curve, the representative value is the value of the curve at the position of the row. On a Kaplan-Meier curve, the representative value of a row at a time with an event or censoring is the survival probability after the drop at that time. The shift that the Jitter and Dodge positions give a point is not part of the representative value, and MIDAS compares the value before the shift.

On a categorical axis, the categories whose intervals on the axis have their centers in the range are the enclosed categories. The condition on an ordered categorical axis is that the column value falls between the first and the last of the enclosed categories. MIDAS treats two kinds of axes as ordered categorical axes: an axis of an Enum column whose measurement scale is ordinal, arranged in the Enum definition order, and an axis of a numeric column whose measurement scale is ordinal, arranged in numeric order. The condition on an axis arranged by the Sort (Pareto) stat is that the rank of the category of the row falls in the range of the ranks of the enclosed categories. The first category on the axis has rank 1. Every other categorical axis is an unordered categorical axis. An axis rearranged by displayOrder of the Sort (Pareto) stat and an axis whose categories the axis settings arrange in an order different from the order of the column values or the ranks are also unordered categorical axes.

The functions compute their values from the same rows and groups as the drawn graph. The functions use only the rows that match the filter of the graph and the Filter of the layer, and compute the values for each facet panel separately. The filter of the graph is the Filter of the graph in Graph Builder, and the filter of the Data Table tab that determines the active dataset in the Statistics and Selected Columns tabs.

The condition contains the width and position of the bins, the bandwidth, and the Time Bin intervals at the time of the drag. When the condition is evaluated again after the dataset is updated, MIDAS uses these values unchanged and computes the counts, means, medians, ranks, and other values from the new data. The condition of a histogram without a Bin Width also contains the upper edge of the last bin. When the condition is evaluated again, every row whose value is at or above this edge falls in the last bin. A Histogram of a column whose values are all integers and a layer whose Bin stat applies Integer Bins align the bin width to an integer, so their conditions do not contain the upper edge of the last bin. When these conditions are evaluated again, the rows whose value is at or above the upper edge of the last bin fall in the bins added beyond it. The Time Bin intervals of a datetime column follow the viewer's time zone at the time of the drag.

In a graph with more than one selectable layer, MIDAS joins the conditions of the layers with OR. Reference line layers, layers with the Cook's Distance Contour stat, and ROC curve layers with a column assigned to Weight cannot be selected. Neither can a layer whose combination of stats has no equivalent in the functions, such as a layer with Smooth after Summary. A layer cannot be selected either when the drag direction includes one of the following axes:

  • An unordered categorical axis
  • An axis that is assigned no column and on which the stat produces no value
  • A y axis stacked without a stat
  • A y axis whose first stat is Cumulative Sum, Sort (Pareto), or Transform
  • A y axis with a Transform or Cumulative Sum stat after a box plot, a Q-Q plot, or a Summary that outputs no aggregate to y
  • The y axis of Density with two or more groups and no bandwidth specified
  • A y axis stacked with two or more columns assigned to grouping aesthetics

A graph with no selectable layer in the drag direction does not show the Select mode button. Direction under Brush Selection of the Custom Graph changes the drag direction. The drag direction of graphs other than the Custom Graph cannot be changed.

When you replace the selection by clicking an element, cell, or count, or by dragging over a range, MIDAS records the condition of what you selected.2 When you select table rows in the Data Table or Filtered Data tab by clicking, MIDAS does not record a condition. This is because rows selected in a table, such as the 5th through 10th rows of a sorted table, cannot always be expressed as a condition on column values.

When you add rows to or remove rows from a selection with a recorded condition by clicking while holding Ctrl/Cmd, MIDAS records a condition that represents the rows after the change. When you add rows, MIDAS joins the recorded condition and the element's condition with OR. When you remove rows, MIDAS joins the recorded condition and the negation of the element's condition with AND. When you add or remove rows by clicking while holding Ctrl/Cmd on a non-empty selection without a recorded condition, MIDAS does not record a condition. When the selection is empty, a click while holding Ctrl/Cmd replaces the selection and records the element's condition, as a click without Ctrl/Cmd does.

When the rows that a graph element, cross tabulation cell, or Most frequent count represents are narrowed by a filter, MIDAS selects the rows that satisfy both the condition and the filter. In Graph Builder, this filter is the graph's Filter. In the Statistics and Selected Columns tabs, it is the filter of the Data Table tab that determines the active dataset.

The Filtered Data Tab

The Filtered Data tab shows the rows filtered by a condition, as a dataset that only the tab holds. Below, the dataset that the tab filters is called the source dataset. The tab does not change the source dataset. The tab's dataset is not added to the project's list of datasets, so you cannot choose it as the dataset for Graph Builder or a model. To use the same rows in Graph Builder or a model, save them as a Derived Dataset with Save as Dataset.

Opening the Tab

Double-clicking a graph element, cross tabulation cell, or Most frequent count opens a Filtered Data tab. The tab shows the rows that the element, cell, or count represents.

Filtered Data tab opened by double-clicking a Crosstab cell

When MIDAS has recorded a condition for the selection, you can open a Filtered Data tab with Open as Filtered Data in the context menu of a graph that shows the dataset of the selected rows. The tab shows the rows that satisfy the recorded condition. The tab where the condition was recorded and the tab of the graph whose menu you use can be different.

A Filtered Data tab opened from a graph narrowed by a filter shows only the rows that satisfy both the condition and the filter.

For graphs whose Select & drill down on in Graph Builder specifies another dataset, and for graphs in analysis tabs whose rows correspond to the rows of the dataset used for the analysis, double-clicking and Open as Filtered Data open a Contributing rows tab instead of a Filtered Data tab. The Contributing rows tab shows the rows of the specified dataset or of the dataset used for the analysis that correspond to the rows the element represents.

Additional Filtering

Writing a condition in the filter input of the Filtered Data tab narrows the tab's display further. The condition uses the same syntax as the Data Table filter, described in Filter Expressions. An additional condition does not change the tab's dataset.

When the Filtered Data tab determines the active dataset, the Statistics and Selected Columns tabs aggregate the rows after the additional condition is applied.

When the Source Dataset Changes

When the source dataset is updated, MIDAS re-evaluates the condition of each open Filtered Data tab with the new data. MIDAS clears the row selection of the tab's dataset. The tab then shows the rows of the new data that satisfy the condition.

The rows of a Contributing rows tab are handled in the same way. When the source dataset is updated, MIDAS clears the row selection, and derives the rows again.

Saving as a Derived Dataset

To keep the rows of a Filtered Data tab after closing the tab, save them as a Derived Dataset. This is because the tab's dataset is discarded when you close the tab.

Save as Dataset in the Filtered Data tab creates a Derived Dataset whose input dataset is the source dataset. This Derived Dataset filters the input dataset with both the condition the tab was opened with and the additional condition. Therefore, when the source dataset is updated, MIDAS rebuilds the saved Derived Dataset from the new data. Recomputation of Derived Datasets is described in Datasets.

To save selected rows as a Derived Dataset, open a Filtered Data tab with Open as Filtered Data and then use Save as Dataset. A selection without a condition cannot be opened in a Filtered Data tab, so it cannot be saved as a Derived Dataset.3

Rows narrowed by the filter of a Data Table tab can be saved as a Derived Dataset with Save Filtered Data in that Data Table tab. See Data Table filter for the steps.

Row Selection, the Filtered Data Tab, and the Data Table Filter

Row selection, showing rows in the Filtered Data tab, and the Data Table filter differ in whether they change what is aggregated and whether they are contained in the project file.

Row selection does not change what is aggregated and is not contained in the project file. The Statistics and Selected Columns tabs aggregate the same rows regardless of the selection and only highlight the selected rows.

The Filtered Data tab narrows what the Statistics and Selected Columns tabs aggregate when it determines the active dataset, and it is contained in the project file if it is open when you save the project.

The Data Table filter changes what the Statistics and Selected Columns tabs aggregate when the filtered Data Table tab determines the active dataset, and it is contained in the project file as part of the tab's state. The filter does not affect Graph Builder, Crosstab, or model computations.

Footnotes

  1. For selecting rows from the Agent API, see datasets.selectRows(). ↩

  2. MIDAS also records the condition when you select rows by passing a condition through the Agent API. ↩

  3. Even for a selection without a condition, exporting from the Data Table can write out only the selected rows. See Exporting Data for the steps. ↩