I want to have a bar plot ordered by species frequency using AlgebraOfGraphics.jl.
using PalmerPenguins, DataFrames, AlgebraOfGraphics, CairoMakie, CategoricalArrays, Chain
# Load and clean the data
penguins = @chain PalmerPenguins.load() begin
DataFrame
dropmissing
end
# Create the plot layer with frequency
penguin_layer = data(penguins) * frequency() * mapping(:species)
draw(penguin_layer)
in R i could do somthing like this
```{=r}
library(tidyverse)
library(palmerpenguins)
penguins |>
drop_na()|>
ggplot()+
aes(x=fct_infreq(species))+
geom_bar()