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

[R-package] fixed uses of class() #5426

Merged
merged 1 commit into from
Mar 20, 2020
Merged

[R-package] fixed uses of class() #5426

merged 1 commit into from
Mar 20, 2020

Conversation

jameslamb
Copy link
Contributor

In this PR, I'd like to propose a minor change in the R package. I found two passes where typeof(x) == 'list or typeof(x) != 'list' is being used to check that something is a list.

This check isn't totally safe, since data.table or data.frame objects will pass this check.

typeof(data.frame())

[1] "list"

typeof(data.table::data.table())

[1] "list"

In this PR, I propose changing to a stricter check, identical(class(x)) == 'list'.

Thanks for your time and consideration!

@pommedeterresautee pommedeterresautee merged commit 4b7e2b7 into dmlc:master Mar 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
@jameslamb jameslamb deleted the r/class branch June 1, 2021 04:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants