Public
Edited
Jul 23, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fishing = [{river: "San Juan", species: "rainbow", lengthInches: 18.2},
{river: "San Juan", species: "brown", lengthInches: 14.1},
{river: "San Juan", species: "brown", lengthInches: 21.5},
{river: "Rio Grande", species: "brown", lengthInches: 9.0},
{river: "Rio Grande", species: "brown", lengthInches: 12.5},
{river: "Rio Grande", species: "cutthroat", lengthInches: 10.6},
{river: "Rio Grande", species: "brown", lengthInches: 14.5},
{river: "Rio Chama", species: "rainbow", lengthInches: 8.5},
{river: "Rio Chama", species: "rainbow", lengthInches: 11.5}]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//Group the data by species, then get an array of objects for rainbow trout.

Insert cell
Insert cell
Insert cell
// Use Array.filter to get a subset only for rainbow trout in fishing:

Insert cell
Insert cell
// Find the mean trout length by river:

Insert cell
Insert cell
// Get just the mean trout size for the San Juan River:

Insert cell
Insert cell
Insert cell
Insert cell
// Load the us_imports.csv file (attached in this notebook):
us_imports = FileAttachment("us_imports.csv").csv({typed: true})
Insert cell
Insert cell
Insert cell
Insert cell
// Return an array of all values in the 'value' property of us_imports, log transformed

Insert cell
Insert cell
Insert cell
// Create a new array, usLogValue, containing all existing properties and ADDING the log transformed value as a property named logValue:

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { showMe } from "@observablehq/show-me"
Insert cell
import { addTooltips } from "@mkfreeman/plot-tooltip"
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.
Learn more