Reputation: 3775
I have the integer64
issue that instead of NA
it shows 9218868437227407266
as it's described here: fread() fails with missing values in integer64 columns
I have loaded bit64
package that with data.table 1.9.5
or greater supposedly displays NAs
instead of 9218868437227407266s
but it doesn't work. The issue is described here and is a bit64
issue: https://github.com/Rdatatable/data.table/issues/488
I wrote this as a "solution":
dt[as.character(my_col) == "9218868437227407266", my_col := as.integer64(NA)]
It works but I wonder how I can write that in dplyr syntax to use the %>%
without unexpected crashes.
Many thanks in advance !
Upvotes: 0
Views: 568
Reputation: 887501
We can use replace
library(dplyr)
dt %>%
mutate(my_col = replace(my_col, as.character(my_col) == "9218868437227407266",
as.integer64(NA))
Upvotes: 1