I am trying to modify a graph produced by interaction library, which according to documentation is a ggplot object. Specifically, I want to modify the y axis limits.
library(interactions)
alpha = 5
w = 4
r = 4
wr = 4
w1 = rnorm(1000,10,2)
r1 = rnorm(1000,10,2)
e = rnorm(1000,0,100)
y = alpha + w*w1 + r*r1 + wr*w1*r1 + e
m = lm(y~ w1 + r1 + w1*r1)
p<- johnson_neyman(m,pred=r1,modx=w1,mod.range = c(0,100))
#element which is ggplot object
q <- p[3]
Based on search of past questions, I tried
q <- q +ylim(c(0,1000))
which gives "NULL".
Also tried
ggplot_build(q)
Which gives
Error in UseMethod("ggplot_build") : no applicable method for 'ggplot_build' applied to an object of class "list"