library(tidyverse)
<- palmerpenguins::penguins %>%
data mutate(across(where(is.factor), as.character)) %>%
filter(!is.na(sex))
ojs_define(data = transpose(data))
Quarto & Plotly
R: Prepare data
see origin of filtered
data_used
below
.table(data_used) Inputs
Reactive UI Elements
Species Filter Logic
= d3.rollups(data,
speciesCount => v.length,
v => d.species)
d .map(row => ({Species: row[0], n: row[1]}))
= [...new Set(speciesSelection.map(row => row.Species))]
speciesFilter
= speciesFilter.length !== speciesCount.length
data_used ? data.filter(d => speciesFilter.includes(d.species))
: data
Species Filter
Stack Toogle
= ({
options title: `Count of Penguins by Gender & Island (n: ${data_used.length})`,
barmode: doStack ? "stack" : "group"
})