Skip to content
New issue

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

bug in dropTerm #105

Open
CeresBarros opened this issue May 31, 2024 · 2 comments
Open

bug in dropTerm #105

CeresBarros opened this issue May 31, 2024 · 2 comments

Comments

@CeresBarros
Copy link
Member

CeresBarros commented May 31, 2024

reprex

repos <- c("predictiveecology.r-universe.dev", getOption("repos"))
install.packages(c("LandR"), repos = repos)
library(LandR)

dropTerm("B ~ logAge * speciesCode + cover * speciesCode + (logAge + cover + speciesCode | ecoregionGroup)", c("speciesCode"))
# Error in str2lang(x) : <text>:2:0: unexpected end of input
# 1: . ~ . -
#   ^
dropTerm("B ~ logAge * speciesCode + cover * speciesCode + (logAge + cover + speciesCode | ecoregionGroup)", c("cover"))
# Error in str2lang(x) : <text>:2:0: unexpected end of input
# 1: . ~ . -
#   ^
@CeresBarros
Copy link
Member Author

I've tracked this down to a bad subsetting of the fac matrix, which results in an empty toDrop object.

However, there's another deeper problem. Even after making sure that the formula terms where speciesCode and cover appear are correctly identified, the way the function is written results in completely dropping (logAge + cover + speciesCode | ecoregionGroup), instead of keeping (logAge | ecoregionGroup)...

@CeresBarros
Copy link
Member Author

@achubaty @ianmseddy @eliotmcintire I'm worried about this and I can't find a good way of fixing the issue. So more eyes would be appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant