recognize possible variants of object.name$call[1] in .model.identify #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for creating stargazer and fielding this pull request.
This commit updates
.model.identifyto fix a bug that results in some supported models going unknown depending on the syntax used to run them.In particular,
(object.name$call[1]=="clm()") == FALSEif the user puts inordinal::clm(...)rather thanclm(...)when running the model, which leads.model.identifyto fail to recognize the model even though it is supported. The former syntax produces the same model object, except for the call, and is recommended in at least some if not all contexts (see http://r-pkgs.had.co.nz/namespace.html#imports), so it's probably a good idea to support it. All models identified the same way (by call rather than class) appear to be affected similarly.Instead of checking that
object.name$call[1]is equal to a certain value, this version uses packagestringrto matchobject.name$call[1]against a pattern, e.g.:if (stringr::str_detect(as.character(object.name$call[1]), ":?clm()")) {return("clm")}This pattern will match
clm()andordinal::clm()but not, say,fooclm().Thank you again for considering this pull request.