Vega-Lite: Aggregate a nominal field by concatenation?

As distinct from this query, I wonder if Vega-Lite supports ‘aggregating’ a nominal field across groups of data points by analogy of string concatenation with number addition.

The reason for wishing to do this may be apparent in this notebook, where I have had to do some awkward work to avoid obliteration of tooltips when points are overplotted. I think it would be perfectly appropriate (especially working in an exploratory mode) to simply show one marker at each (placebo,GDNF) coordinate represented in the data, and then display all associated adverse events concatenated.

See Adverse-Event Graphics for RCTs / Mario Delgado / Observable for a possible approach.

1 Like

Thanks Mario! I’m still getting my bearings with Vega-Lite, but working through your example (with its helpful documentation links) helps me to articulate this better. What I might have hoped for is that concat might be a supported aggregate operation, so that something like this would be possible:

    vl.tooltip().concat('adverse_events', ';\n'), // <-- would be nice
    vl.color().fieldQ('surprisal_bits').scale({scheme: 'turbo'}),

This is probably a better use case for Vega-Lite Lookups: