Reputation: 305
I think there is a glitch in the sjplot package, but wanted to ask what people thought first. Here is my code that produces an error, which from my understanding should work just fine
library(sjmisc)
data(efc)
efc <- to_factor(efc, c161sex, e42dep, c172code)
m <- lm(neg_c_7 ~ pos_v_4 + c12hour + e42dep + c172code, data = efc)
# create plot-object
p <- plot_model(m, type="pred")
# change theme
p + labs(x="")
I get this Error in p + labs(x = "") : non-numeric argument to binary operator
Upvotes: 1
Views: 146
Reputation: 132959
From the documentation:
Depending on the plot-type, plot_model() returns a ggplot-object or a list of such objects.
And indeed:
class(p)
#[1] "list"
length(p)
#[1] 4
You have four ggplot2 objects in a list. You'll need to change the labels for each of them (e.g., by iterating over the list).
Upvotes: 0