<- reactive({
top_sites sites_program() %>%
::group_by(time) %>%
dplyr::count(site)%>%
dplyr::top_frac(.5)
dplyr })
I had a graph in a Shiny Application that had too many values and the values were getting scrunched up. I determined to add a tab panel and display multiple views.
I used top_frac
function from the dplyr 📦.
My next dilemma was getting the bottom half. I used Chat-GPT and here is the transcript.
I was able to take the example and apply to my data set. This would have taken me hours to figure our prior to this assistance.
<- reactive({
bottom_sites <- 0.5
bottom_frac <- sites_program() %>%
result ::group_by(time) %>%
dplyr::count(site)%>%
dplyrarrange(n) %>%
slice(1:floor(n() * bottom_frac))
})