Feature request: I want to use update.formula to subtract an intercept (or other) term from a formula with a dot on the RHS. However, as this causes an error, I propose a patch below.
Thus, I want: > update.formula(y ~ ., ~ . -1) [1] y ~ . - 1 Instead I get this error: Error in terms.formula(tmp, simplify = TRUE) : '.' in formula and no 'data' argument While the error message isn't especially helpful (as I *cannot* currently pass in a data argument), the problem is that terms.formula inside update.formula does not allow a dot in the RHS of 'old' unless either a 'data' argument is passed in or 'allowDotAsName=TRUE'. Thus, I'd like to suggest this change to update.formula to allow a dot in the RHS of old without (I believe) impacting any other behavior. - out <- formula(terms.formula(tmp, simplify = TRUE)) + out <- formula(terms.formula(tmp, simplify = TRUE, allowDotAsName=TRUE)) If this is undesirable for some reason, then alternatively the dots argument of update.formula could be passed to terms.formula so the user could pass in either 'data' or 'allowDotAsName=TRUE' themselves (though as I cannot think of any reason the user would prefer 'allowDotAsName=FALSE', this is not my preference). - out <- formula(terms.formula(tmp, simplify = TRUE)) + out <- formula(terms.formula(tmp, simplify = TRUE, ...)) >From my reading of the Details section of ?update.formula, it seems as if this >suggestion is consistent with the current documentation, as no mention is made >of dots in the RHS of 'old', and no mention is made of why this behavior >should be otherwise prohibited. If neither change is desirable for some >reason, then the update.formula documentation should at least point out this >exception (e.g. "... and substitutes the _rhs_ of the 'old' formula for any >occurrence of '.' on the right of 'new' *except if there is a dot in the _rhs_ >of 'old'*." Thanks, Robert ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel