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

replacement has lenght zero #42

Closed
verajosemanuel opened this issue Aug 5, 2021 · 1 comment
Closed

replacement has lenght zero #42

verajosemanuel opened this issue Aug 5, 2021 · 1 comment

Comments

@verajosemanuel
Copy link

verajosemanuel commented Aug 5, 2021


Error: Problem with `mutate()` column `predicted`.
i `predicted = make_two_class_pred(...)`.
x replacement has length zero
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning message:
Problem with `mutate()` column `predicted`.
i `predicted = make_two_class_pred(...)`.
i 'x' is NULL so the result will be NULL 

Reproducible example

dm <- structure(list(pred_convert = c(0.1283158659935, 0.147706210613251, 
                                0.124467730522156, 0.137504696846008,
                                0.115710318088531, 0.0456064343452454),
            class = c("non_convert", "convert",
             "non_convert", "non_convert", 
             "non_convert", "non_convert"),
package = structure(c(2L, 3L, 2L,
                      2L, 2L, 2L),
                    .Label = c("111", "112", "121",
                               "131", "211", "221"),
                    class = "factor"),
acc = c(0L, 0L, 0L, 0L, 0L, 0L)),
row.names = c(1L, 2L, 3L, 4L, 5L, 6L),
class = "data.frame")


lvls <- levels(as.factor(dm$class))

dm %>% 
  dplyr::mutate(
    predicted = make_two_class_pred(
      estimate = pred_convert,
      levels = levels(lvls),
      threshold = .12
    )
  )
@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant