Skip to content

[Query] Data Columns

github-actions[bot] edited this page Nov 27, 2026 · 1 revision

Generated from 'wiki-query.ts' on 2026-11-16, 20:55:37 UTC (v2.17.7), do not edit directly.

Data Columns Query [overview]

Returns the columns of a data frame that can be written at a position, as an editor offers them to complete.
This query is requested with the type data-columns.
Run in the REPL: :query @data-columns (<line:col>;...) <code | file://path>

Editors complete names, and within code that works on a data frame the names worth offering are often its columns: after df$, but also in every argument a call evaluates within its data, as filter, mutate, subset, with, or aes do. flowR knows which arguments a call evaluates that way (they are quoted in the dataflow graph), so this works for every such call, not just for a fixed list of them. The data frame is another argument of that call, the left side of a pipe into it, or, for a layer like geom_point(aes(...)), an argument of what it is added to. Its columns come from the Abstract Interpretation Query of data frame shapes, which also knows the data sets R finds as lazy data, like penguins of datasets or starwars of dplyr (once loaded, or as dplyr::starwars).

Consider the following code, with the cursor just after the bi (line 2, column 34):

library(dplyr)
penguins |> filter(year > 2008, bi)

The query asks for the columns at that position:

[ { "type": "data-columns",   "positions": [ "2:34" ] } ]

(This can be shortened to @data-columns (2:34) "library(dplyr)\npenguins |> filter(year > 2008, bi)" when used with the REPL command :query).

Results (prettified and summarized):

Query: data-columns (2 ms)
   ╰ 2:34 (masked of penguins): species, island, bill_len, bill_dep, flipper_len, body_mass, sex, year

Show Detailed Results as Json

The analysis ran (including parsing and normalization and the query) within the generation environment.

The JSON contains the ids of the nodes in question (see the Interface wiki page).

{"data-columns":{".meta":{},"results":{"2:34":{"context":"masked","columns":["species","island","bill_len","bill_dep","flipper_len","body_mass","sex","year"],"frames":[{"id":5,"lexeme":"penguins","must":["species","island","bill_len","bill_dep","flipper_len","body_mass","sex","year"],"may":[],"exact":true}]}}},".meta":{}}

The position has to fall within a node. An editor completing a name not typed yet, as in filter(penguins, ), inserts a placeholder name at the cursor first.

Implementation Details

The Data Columns Query is executed by executeDataColumnsQuery.

Clone this wiki locally