Skip to content

Conversation

@deepfriar
Copy link

Thanks for creating stargazer and fielding this pull request.

This commit updates .model.identify to 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()") == FALSE if the user puts in ordinal::clm(...) rather than clm(...) when running the model, which leads .model.identify to 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 package stringr to match object.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() and ordinal::clm() but not, say, fooclm().

Thank you again for considering this pull request.

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.

1 participant