Skip to content

Fix a bug when attempting to use multiple constraints#27

Open
RussianImperialScott wants to merge 1 commit into
hturner:mainfrom
RussianImperialScott:allow-multiple-constraints
Open

Fix a bug when attempting to use multiple constraints#27
RussianImperialScott wants to merge 1 commit into
hturner:mainfrom
RussianImperialScott:allow-multiple-constraints

Conversation

@RussianImperialScott

Copy link
Copy Markdown

This PR fixes a bug during the step where the gnm() function determines which coefficients to constrain based on the arguments to the function call. The original code askes if(res == 0 && length(constrain) == 1), which seems to be testing for the situation where constrain is a character vector of length 1 but does not match any of the existing coefficient names. However, when two or more coefficients to constrain are specified, then the result of res == 0 has a length greater than 1, and this causes either a warning or error (depending on the version of R, it seems?) when matched with the scalar "AND" operator &&. By using identical(res, 0) instead, we get around this issue.

@alan-groot

Copy link
Copy Markdown

I have run into the same issue. This fix works for me.

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

Successfully merging this pull request may close these issues.

2 participants