Skip to content

Fix some problematic class comparisons#389

Open
MichaelChirico wants to merge 1 commit intormcelreath:masterfrom
MichaelChirico:fix-class-eq
Open

Fix some problematic class comparisons#389
MichaelChirico wants to merge 1 commit intormcelreath:masterfrom
MichaelChirico:fix-class-eq

Conversation

@MichaelChirico
Copy link

class() is not guaranteed to return an object of length 1, so statements like if (class(x) == "y") are problematic since this is often a vector comparison inside a scalar logical operator (if).

I fixed a few of these for illustration, but many more remain in the package. You can see them with lintr::lint_package(linters = lintr::class_equals_linter()).

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

Comments