[R] Formula compared to call within model call

Tim Taylor t|m@t@y|or @end|ng |rom h|ddene|eph@nt@@co@uk
Wed Aug 11 10:45:48 CEST 2021

Manipulating formulas within different models I notice the following:

m1 <- lm(formula = hp ~ cyl, data = mtcars)
m2 <- update(m1, formula. = hp ~ cyl)
all.equal(m1, m2)
#> [1] TRUE
identical(m1, m2)
#> [1] FALSE
waldo::compare(m1, m2)
#> `old$call[[2]]` is a call
#> `new$call[[2]]` is an S3 object of class <formula>, a call

I'm aware formulas are a form of call but what I'm unsure of is whether there is meaningful difference between the two versions of the models? Any clarification, even just on the relation between formulas and calls would be useful.

More information about the R-help mailing list