Bug 16326 - update.formula does still not work properly
Summary: update.formula does still not work properly
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Models (show other bugs)
Version: R 3.1.3
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-04-21 13:00 UTC by Mathias
Modified: 2016-02-22 08:00 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias 2015-04-21 13:00:47 UTC
This is a follow-up to the bug report 15735 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15735). 

That bug has been reported as fixed in the "CHANGES IN R 3.1.1 - Bug fixes": "For a formula with exactly 32 variables the 32nd variable was aliased to the intercept in some C-level computations of terms, so that for example attempting to remove it would remove the intercept instead (and leave a corrupt internal structure)"

The example code in the old bug report now returns the expected results indeed: 
> myFormula <- as.formula(paste(c("y ~ x0", paste0("x", 1:30)), collapse = "+"))
> updateArgument <- as.formula(paste(c(". ~ . ", paste0("w", 1:20)), collapse = " - "))
> update(myFormula, updateArgument)
y ~ x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + 
    x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 + 
    x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x30

However, after a slight modification, the problem seems to reappear:
> myFormula <- as.formula(paste(c("y ~ x0", paste0("x", 1:29)), collapse = "+"))
> update(myFormula, updateArgument)
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + 
    x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 + 
    x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x0:w4:w5:w6:w7:w8:w9:w10:w11:w12:w13 - 1

Repeated evaluation of update(myFormula, updateArgument) yields different results.