We are using https://pbeshai.github.io/tidy/ for some data manipulation in javascript. We are looking to concatenate all strings for a grouped field in a summarise() after using groupby(). Trying to do something like:
let myArr = [
{ group: 1, field: 'okay' },
{ group: 1, field: 'sir' },
{ group: 2, field: 'yes' },
{ group: 2, field: 'there' },
]
tidy(myArr,
groupBy('group', [
summarise({
allStrings: concat('field', sep=' ')
})
])
)
and get as an output:
[
{ group: 1, allStrings: 'okay sir' },
{ group: 2, allStrings: 'yes there' }
]
Not seeing anything in the docs in the summarizers section for this unfortunately. allStrings: concat('field', sep=' ')
is invalid as there is no concat
summarizer function in tidy.js... Is this possible in tidy.js? If not, is there a straightforward way to string_agg / concat strings within a group in javascript like this?