R Under development (unstable) (2023-11-02 r85465 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > if (.Platform$OS.type != "windows") { + library(lme4) + library(testthat) + fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) + expect_equal(colnames(model.frame(fm1)),c("Reaction","Days","Subject")) + expect_equal(colnames(model.frame(fm1,fixed.only=TRUE)),c("Reaction","Days")) + expect_equal(formula(fm1),Reaction ~ Days + (Days | Subject)) + expect_equal(formula(fm1,fixed.only=TRUE),Reaction ~ Days) + + ## ugly example: model frame with compound elements + fm2 <- lmer(log(Reaction) ~ splines::ns(Days,3) + + + I(1+Days^3) + (Days|Subject), sleepstudy) + expect_equal(names(model.frame(fm2)), + c("log(Reaction)", "splines::ns(Days, 3)", + "I(1 + Days^3)", "Days", "Subject")) + expect_equal(names(model.frame(fm2,fixed.only=TRUE)), + c("log(Reaction)", "splines::ns(Days, 3)", + "I(1 + Days^3)")) + + } ## skip on windows (for speed) > > proc.time() user system elapsed 0.18 0.09 0.26