QQ Plot Using ggformula Error


#1

I am interested in creating a qq plot using ggformula. Here is my code:

#Construct a QQ plot

install.packages('ggformula')
library(ggformula)
library(ggplot2)

couples <- read.csv('age.csv') #simply the ages (int) of wife (WAge) and husband(HAge)
fit <- lm(WAge ~ HAge, data = couples)
summary(fit)

diag <- augment(fit)
ggplot(data = diag, aes(sample = .resid)) +
  geom_qq() + stat_qqline()

But…here’s the error message:

Error in stat$parameters(TRUE) : attempt to apply non-function
In addition: Warning messages:
1: In structure(NULL, class = "waiver") :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(NULL, class = "waiver") :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

Any thoughts would be appreciated and thank you!
Greg


#2

Have you tried geom_qq_line() instead of stat_qqline()? I typically use geom_qq_line() but it looks like you can also use stat_qq_line() and you just forgot an underscore in the function call.