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

tidyr::fill(everything()) fails for character columns #327

Closed
lindeloev opened this issue Jan 5, 2022 · 2 comments
Closed

tidyr::fill(everything()) fails for character columns #327

lindeloev opened this issue Jan 5, 2022 · 2 comments

Comments

@lindeloev
Copy link

This fails and I would expect it to fill the NA in the character column:

data.frame(x = c("A", NA, "B")) %>%
    dtplyr::lazy_dt() %>%
    tidyr::fill(everything())

Error in nafill(x, "locf") :
'x' argument must be numeric type, or list/data.table of numeric types

It runs as expected without everything() and on numeric data, but the mere presence of a character column causes it to fail.

R 4.1.1
dtplyr 1.2.0 installed from CRAN
tidyr 1.1.4 installed from CRAN

@markfairbanks
Copy link
Collaborator

Unfortunately this is a limit of data.table as it doesn't support filling with character columns yet (see Rdatatable/data.table#3992).

For now we would recommend using tidyr::fill() directly on a data frame instead of a lazy_dt.

@markfairbanks
Copy link
Collaborator

In the documentation you'll see it mentioned that fill() only works on numeric columns in dtplyr.

There was a design discussion here around how to handle fill() in dtplyr if you want some more context.

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

No branches or pull requests

2 participants