- Transforming data:
- aggregate
- collect
- window
- filter
- Building bar plots with transformed data
September 27 2022
We will be working with data on Ferris Wheels from Tidy Tuesday.
Question: What is the top 5 countries with the most Ferris Wheels?
Four transform objects:
count in descending orderrankCreate two scales, one of type band and another linear to map the variables country and count
Add axes to your spec so that you can check your work.
x and y to your variablesy2 and widthx2 and heightx and y to your variablestext use your numeric variabledx and dy properties to adjust the text positionfillAdd all the titles you deem necessary
rect marks for colorupdate: {
fill: { value: "black" }
},
hover: {
fill: { value: "LightGray" },
strokeWidth: { value: 2 },
stroke: { value: "black" }
}
{
name: "aggregated",
source: "ferrisWheels",
transform: [
{
type: "aggregate",
groupby: ["country"],
fields: ["height"],
ops: ["mean"],
as: ["m"]
}
]
}