I have this code part of a function :
dataplot <- data.frame(x,y)
p <- ggplot(dataplot, aes(x=x, y=y))
print(p)
# Dataset using for plotting
ggplot_build(p)
And when I run the code there's no problem but as soon as I compile it into an HTLM file there's a problem I get this error message
Error in data.frame(x,y) : p not found
How could you explain this ?