[go: nahoru, domu]

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

Add colnames to tibble and data.frame if missing #284

Closed
hbaniecki opened this issue Aug 15, 2020 · 0 comments · Fixed by #285
Closed

Add colnames to tibble and data.frame if missing #284

hbaniecki opened this issue Aug 15, 2020 · 0 comments · Fixed by #285
Labels
before release 📌 TODO before release maintenance 🔨 Code enhancements, tests and maintenance R 🐳 Related to R short term ⏰ TODO short term
Milestone

Comments

@hbaniecki
Copy link
Member
hbaniecki commented Aug 15, 2020

The is.null(rownames(data)) and is.null(colnames(data)) should be independent from the matrix condition, as both tibble and data.frame could have colnames missing.

DALEX/R/explain.R

Lines 165 to 178 in 10ff6ea

if ("tbl" %in% class(data)) {
data <- as.data.frame(data)
verbose_cat(" -> data : tibbble converted into a data.frame \n", verbose = verbose)
}
# as was requested in issue #155, It works becasue if data is NULL, instruction will not be evaluated
if ("matrix" %in% class(data) && is.null(rownames(data))) {
rownames(data) <- 1:n
verbose_cat(" -> data : rownames to matrix was added ( from 1 to", n, ") \n", verbose = verbose)
}
# issue #181 the same as above but for columns
if ("matrix" %in% class(data) && is.null(colnames(data))) {
colnames(data) <- 1:ncol(data)
verbose_cat(" -> data : colnames to matrix was added ( from 1 to", ncol(data), ") \n", verbose = verbose)
}

edit: use is.matrix() (?)

@hbaniecki hbaniecki added before release 📌 TODO before release short term ⏰ TODO short term maintenance 🔨 Code enhancements, tests and maintenance R 🐳 Related to R labels Aug 15, 2020
@hbaniecki hbaniecki added this to the DALEX v2.0.0 milestone Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
before release 📌 TODO before release maintenance 🔨 Code enhancements, tests and maintenance R 🐳 Related to R short term ⏰ TODO short term
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant