thomas-neitmann/ggcharts

A simple sequence of the data frame should be sufficient to achieve the order sequence rather then pulling out the variable and sequencing on it.

Closed this issue · 1 comments

I noticed that in the pyramid_chart function if there is no sorting order then you create a sequence vector and assign it to order.
order <- data %>% dplyr::pull(!!x) %>% seq_along()
It would be a little efficient to just to use order <- 1:nrow(data).
Is there a specific reason why you do this by pulling the variable out?
I get that for creating the limit you have to pull the y column out but I don't think you'd need to do that for order.

Thanks a lot for digging into the code of pyramid_chart() @vedhav!

Indeed, simply calling order <- 1:nrow(data) should be sufficient. Don't ask me why I choose this much more difficult solution with dplyr::pull() 🤷‍♂️