Roland - 11 months ago 58

R Question

I'm trying to do a plot "Theoretical Quantiles"X "Standardized Residuals" using

`ggplot2`

I have a

`lm()`

`library(ggplot2)`

model<-lm(mpg~cyl+disp+hp+drat+wt, data=mtcars)

p2<-ggplot(model, aes(qqnorm(.stdresid)[[1]], .stdresid))+geom_point(na.rm = TRUE)

p2<-p2+geom_abline(aes(qqline(.stdresid)))+xlab("Theoretical Quantiles")+ylab("Standardized Residuals")

p2<-p2+ggtitle("Normal Q-Q")+theme_bw()

p2

This code that I founded here https://rpubs.com/therimalaya/43190 make the plot, but returns an error

`Error: Aesthetics must be either length 1 or the same as the data (3110): x`

and I can't change the

`xlab`

`ylab`

Answer Source