Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R Code Injection/Code Reuse not working #84

Closed
camccaffrey opened this issue Oct 2, 2022 · 3 comments
Closed

R Code Injection/Code Reuse not working #84

camccaffrey opened this issue Oct 2, 2022 · 3 comments

Comments

@camccaffrey
Copy link

If I put the following code in an R code block, it will output a scatterplot as expected.

library(ggplot2)
scatterplot <- ggplot() +
	geom_point(aes(x=rnorm(10),y=rnorm(10)))
plot(scatterplot)

However, if I move the library(ggplot2) statement to the "Inject R code" box in the plugin settings or to a pre-r code block, I get the following error message:

Error in ggplot() : could not find function "ggplot"
Execution halted

In this example, it seems as if the package cannot load unless I include it in the original code block. Is this a bug, or am I using these two features incorrectly?

@milan338
Copy link
Collaborator

milan338 commented Oct 2, 2022

Thanks for pointing this out, it's a bug. I'm also getting the same issue, should have a fix soon.

@twibiral
Copy link
Owner

twibiral commented Oct 2, 2022

I fixed it and will release the fix in a few moments

twibiral added a commit that referenced this issue Oct 2, 2022
@twibiral
Copy link
Owner

twibiral commented Oct 2, 2022

Fixed with release 0.18.0. The code from the inject field was added but ignored then. This only happened for R.

@twibiral twibiral closed this as completed Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants