IndrajeetPatil / statsExpressions

Tidy data frames and expressions with statistical summaries 📜
https://indrajeetpatil.github.io/statsExpressions/
Other
312 stars 20 forks source link

"variable" does not work as an x value in ggbetweenstats #157

Closed RussellGrayxd closed 2 years ago

RussellGrayxd commented 2 years ago

Title says it all. the column header "variable" does not play nicely with the x arguement of ggstatsplot, but is a common column name with melted data frames used for boxplots.

Example:

library(ggstatsplot)

Var1 <- c("test1","test2","test3", "test1","test2","test3", "test1","test2","test3") Var2 <- rnorm(n=9, 1, 2)

test.data <- data.frame(cbind("variable"=Var1,"value"=Var2))

ggstatsplot::ggbetweenstats(test.data, variable, value)

IndrajeetPatil commented 2 years ago

Traces to:

library(dplyr)
library(insight)

df <- dplyr::tibble(
  variable = c(
    "test1", "test2", "test3",
    "test1", "test2", "test3",
    "test1", "test2", "test3"
  ),
  value = rnorm(n = 9, 1, 2)
)

df %>%
  group_by(variable) %>%
  group_modify(~standardize_names(datawizard::describe_distribution(.), style = "broom")) %>%
  ungroup()
#> Warning: Need at least 4 complete observations for type-2-kurtosis Using
#>   'type="1"' now.
#> Error in `group_modify()`:
#> ! The returned data frame cannot contain the original grouping
#>   variables: variable.

Created on 2022-05-09 by the reprex package (v2.0.1)