Closed sfd99 closed 3 years ago
Thanks for the report!
I've been able to pinpoint the issue to a difference between retrieving an object that has the same name as an internal function (such as plot
) from within a package's function vs outside of a package function. It looks like at some point, perhaps because of changes to R, it changed.
To show you what I mean:
sum <- "test"
test <- function() { browser() }
inside a file in the R folder (where package functions go)test <- function() { browser() }
but define it in the console, don't save it as a file in the packagedevtools::load_all()
test()
and when you have control of the console, type sum
to see its value. You will get the function.test2()
and again type sum
. This time you'll get the value from the globalenvThis is why the example code using the variable name "plot" is breaking. I don't know when this started happening. I'll change the example to a different variable name.
Thanks Dean for the fix. That was quick!. :-)
ggMarginal(p) now works fine from the Rstudio [Console Panel].
But, the Addin alternative, with: p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
ie: highlight p in the [Console Panel] then click on: "ggplot Marginal Plots" in Addins, still gives an error message:
> ggExtra:::ggMarginalGadgetAddin () Error in ggExtra:::ggMarginalGadgetAddin() : Please highlight a ggplot2 plot before selecting this addin.
Yet, the letter p in the [Console Panel] (a ggplot), has been hilited before clicking on the Addin. as prescribed.
Maybe I'm missing something basic?... sfd99 San Francisco latest Rstudio, R, Ubuntu Linux 20.04. ggextra Version 0.9.0.1 - installed f/GIThub.
It may have seemed quick to you but it was a very long frustrating hour of debugging for me :)
p
causes the same issue. p
is a function in shiny (well, actually, in htmltools), for creating paragraph in HTML. Basically you can't use a variable that is already a function.
I'll reopen this because this problem should be handled better rather than my bandaid solution of "don't do this". It's strange that this never used to be an issue
Thanks, Dean!.
Your hard work and useful R PKG contributions are highly appreciated.
You are a true PRO...
Hi Dean,
ggExtra = great, useful pkg!.
ggMarginalGadget(plot) or the equivalent Addin. works great from Rstudio's [Source Panel].
But,... from Rstudio's [Console Panel]
Using the ggextra Vignette example, for: ggMarginalGadget(plot)
if (interactive()) { plot <- ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) + ggplot2::geom_point() plot2 <- ggMarginalGadget(plot) }
pops up the interface, but w/ this error message: (in red letters):
_Error with the advanced options: no applicable method for 'ggplotbuild' applied to an object of class "NULL"
Does the ggMarginalGadget() Fx work in the Rstudio [Console Panel] or only from the [Source Panel] ?.
help! sfd99 San Francisco latest Rstudio, R, Ubuntu Linux 20.04.