Closed M-Colley closed 3 years ago
Yeah, this is a long-standing issue in ggstatsplot
. I will try to resolve this before Christmas 🤞
Same as https://github.com/IndrajeetPatil/ggstatsplot/issues/450 and https://github.com/IndrajeetPatil/ggstatsplot/issues/329
What if you do:
library(rlang)
output$plot1 <- renderPlot({
p <- ggstatsplot::ggwithinstats(
data = iris_long,
x = !!x(),
y = !!y(),
type = "np", # type of statistical test
outlier.tagging = FALSE, # whether outliers should be flagged
mean.point.args = list(size = 5, alpha = 0.5, color = "darkblue"),
p.adjust.method = "bonferroni")
})
Does it work?
Hey, unfortunately, it does not work, I still get the same error:
Error in : Only strings can be converted to symbols
Hello, are there any updates on this issue? :) I updated everything (R and relevant packages), but it is still not working. I also tried to find solutions but no luck there....
Kind regards
Sorry, still haven't had time to look at this. I can have a look at the latest in April.
Apologies for not working on this sooner.
It looks like you're passing in a data.frame
to the x and y args, rather than the expected variable symbols. No need to create new dataframes, since you already pass in the data via the data
argument, just pass in a list of strings as follows:
p <- ggstatsplot::ggwithinstats(
data = iris_long,
x = !!sym(input$xcol),
y = !!sym(input$ycol),
...
)
Does this work?
Thanks for the idea, but it does not work:
Warnung: Error in : Problem with `mutate()` input `isanoutlier`.
x (unordered) factors are not allowed
i Input `isanoutlier` is `ifelse(check_outlier(id, outlier.coef), TRUE, FALSE)`.
i The error occurred in group 1: id = "1".
I also tried it with ensym (Warnung: Error in :
argmust be a symbol
) and without sym (same problem as with sym).
Kind regards!
Have you tried applying the data outside of Shiny? Could you provide a minimum reproducible example? That error sounds like a data type or data preprocessing issue.
Well, the problem specifically exists in context with Shiny, which I would want to use. Therefore, an example outside of shiny is not appropriate. The minimum reproducible example is given in the first post.
Hey there, I just wanted to quickly check in if there is already an update on this?
I again tried it and there still is the same problem :)
Kind regards!
Here is a minimally reproducible example of how to get this to work:
set.seed(123)
library(ggstatsplot)
library(shiny)
library(rlang)
ui <- fluidPage(
headerPanel("Example - ggbetweenstats"),
sidebarPanel(
selectInput("x", "xcol", "X Variable", choices = names(iris)[5]),
selectInput("y", "ycol", "Y Variable", choices = names(iris)[1:4])
),
mainPanel(plotOutput("plot"))
)
server <- function(input, output) {
output$plot <- renderPlot({
ggbetweenstats(iris, !! input$x , !! input$y)
})
}
shinyApp(ui, server)
#>
#> Listening on http://127.0.0.1:5464
Created on 2021-04-26 by the reprex package (v2.0.0)
Thank you very much!!
Hey, I'm trying to use ggwithinstats together with shiny.
The error is
I assume that this is due to the ensym function used in the withinstats function (see here).
Do you know a workaround? Maybe something regarding the link?