Closed tobi-lipede-mappa closed 11 months ago
This code works as written for me. Are you sure you're executing the line penguins = dropmissing(DataFrame(PalmerPenguins.load()))
? This line should create the penguins dataset
I am. If it helps at all, I was running Julia 1.10-beta2 on Pluto. I can access the dataframe outside of the macro so it should definitely be defined
Can you try running the code directly in the REPL? I haven't tested the package in Pluto
Confirmed it does work in the REPL. But in Pluto it gives the undefined error
ok - the issue is likely to do with how the environment is chosen for the call to Base.eval inside of pluto. I will take a look and see if I can fix it - in the meantime, a work-around if you want it is to use the AoG compatibility shown in the final example in the readme
Thank you for your help! Will do
I looked into this and was able to reproduce the error, but I can't figure out what's causing it. @kdpsingh any ideas?
Thanks for tagging me. I'll look into it also.
The weird thing is that if I create new macros inside the notebook - like define @ggplot_pluto
and @geom_point_pluto
without changing anything about them, they work as expected. The issue might be something to do with how Pluto manages modules?
This is probably a scoping issue related to the use of eval()
in the package, but I haven't yet had a chance to actually try it out to see what the error is.
It might be possible to refactor a bit and remove the eval
calls - I had intended to try to do that eventually anyway
I realized as I was trying to refactor the eval
calls out that the package actually barely needs macros at all. I have a working version in this branch https://github.com/TidierOrg/TidierPlots.jl/tree/no-eval that only uses one macro (@aes
) and even that can be replaced with a function if you're willing to use strings for column selection ...
This issue is resolved as of version 0.4.0!
If it works without macros, that's great! Even if you're using macros, there's no need to do any evaluation. If you return a quoted expression from a macro, the resulting expression automatically gets evaluated in the user's scope.
So if for any reason we need to go back to using macros, happy to help remove the evaluation piece.
Does this work in Pluto now?
Nevermind, I see from the screenshot that it does!
Not sure whether I'm doing something wrong, but I can't seem to generate any plots. I get an error saying the DataFrame isn't defined, e.g.: