Error generated by nlme::gnls
On Sat, 23 Jul 2022 21:00:25 -0400
Ben Tupper <btupper at bigelow.org> wrote:
Could this be related to a new if() behavior introduced in v4.2.0 ? See the "SIGNIFICANT USER-VISIBLE CHANGES" for v4.2.0 in the NEWS https://cloud.r-project.org/doc/manuals/r-release/NEWS.html
No. What's going on is much weirder than that, and looks to me like
a bug has been introduced in formula() or in something related.
My impression is that if the right hand side of a formula gets "too
long", then it gets split into parts --- which messes everything up.
Consider:
lhs1 <- paste(paste0("x",1:12),collapse=" + ")
f1 <- as.formula(paste("x ~ -1 +",lhs1))
print(length(deparse(f1[[3]])))
You get the value 2. Note that deparse(f1[[3]]) gives
[1] "-1 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + "
[2] " x12"
If we shorten the right hand side of the formula just a wee bit
lhs2 <- paste(paste0("x",1:11),collapse=" + ")
f2 <- as.formula(paste("x ~ -1 +",lhs2))
then deparse(f2[[3]]) is of length 1, as it should be:
deparse(f2[[3]])
[1] "-1 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11"
I could of course be missing something, but it really looks to me as if something has gone up to Puttee here. Some input from someone in R-Core would be valuable here. cheers, Rolf Turner
Honorary Research Fellow Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276