Platform
Resources
Pricing
Sign in
Get started
Peter Beshai
Workspace
Fork
Published
tidy.js
By
Peter Beshai
Edited
May 7, 2021
7 stars
Insert cell
Insert cell
data
=
[
{
group
:
'a'
,
name
:
'n0'
,
value
:
5
}
,
{
group
:
'a'
,
name
:
'n1'
,
value
:
10
}
,
{
group
:
'b'
,
name
:
'n2'
,
value
:
12
}
,
{
group
:
'c'
,
name
:
'n3'
,
value
:
35
}
,
{
group
:
'c'
,
name
:
'n4'
,
value
:
55
}
]
Insert cell
results
=
tidy
(
data
,
groupBy
(
'group'
,
summarize
(
{
total
:
sum
(
'value'
)
,
items
:
items
=>
items
}
)
)
)
Insert cell
Table
(
results
)
Insert cell
JSON
.
stringify
(
results
)
Insert cell
Insert cell
import
{
tidy
,
groupBy
,
summarize
,
sum
}
from
'@pbeshai/tidyjs'
Insert cell
import
{
Table
}
from
"@observablehq/inputs"
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
results
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML