We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's currently totally legal to write a dsm formula with an offset in it. This throws the following warning:
dsm
Warning message: In av[kp] <- as.character(attr(tf, "variables")[1 + off]) : number of items to replace is not a multiple of replacement length
Usually the user will not want 2 offsets, so we should stop them doing this.
The text was updated successfully, but these errors were encountered:
This can be checked using the terms function and looking at the resulting attributes:
terms
> terms(formula(x~y + offset(a))) x ~ y + offset(a) attr(,"variables") list(x, y, offset(a)) attr(,"offset") [1] 3 attr(,"factors") y x 0 y 1 offset(a) 0 attr(,"term.labels") [1] "y" attr(,"order") [1] 1 attr(,"intercept") [1] 1 attr(,"response") [1] 1 attr(,".Environment") <environment: R_GlobalEnv>
so here attr(terms(formula(x~y + offset(a))), "offset") will give the position of the offset term. Whereas when there is no offset:
attr(terms(formula(x~y + offset(a))), "offset")
> terms(formula(x~y)) x ~ y attr(,"variables") list(x, y) attr(,"factors") y x 0 y 1 attr(,"term.labels") [1] "y" attr(,"order") [1] 1 attr(,"intercept") [1] 1 attr(,"response") [1] 1 attr(,".Environment") <environment: R_GlobalEnv>
There is no offset attribute. So testing for presence of that attribute should be enough.
Sorry, something went wrong.
No branches or pull requests
It's currently totally legal to write a
dsm
formula with an offset in it. This throws the following warning:Usually the user will not want 2 offsets, so we should stop them doing this.
The text was updated successfully, but these errors were encountered: