Platform
Resources
Pricing
Sign in
Get started
ikesau
mappy mappy joy joy
Workspace
Fork
Public
By
ikesau
Edited
Feb 10, 2023
Insert cell
Insert cell
randomData
=
new
Array
(
1000
)
.
fill
(
)
.
map
(
(
)
=>
Math
.
floor
(
Math
.
random
(
)
*
100
+
1
)
)
Insert cell
mean
=
randomData
.
reduce
(
(
acc
,
cur
)
=>
acc
+
cur
,
0
)
/
randomData
.
length
Insert cell
geometricMean
=
getGeometricMean
(
randomData
)
Insert cell
Plot
.
rectY
(
randomData
.
map
(
(
value
)
=>
(
{
value
}
)
)
,
Plot
.
binX
(
{
y
:
"count"
}
,
{
x
:
{
value
:
"value"
,
interval
:
4
}
}
)
)
.
plot
(
)
Insert cell
function
getGeometricMean
(
values
)
{
let
log
=
0
;
values
.
forEach
(
(
value
)
=>
{
log
+=
Math
.
log
(
value
)
;
}
)
;
return
Math
.
exp
(
log
/
values
.
length
)
;
}
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
randomData
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mean
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
geometricMean
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
getGeometricMean
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML