我遇到了NA
问题而不是9218868437227407266
它显示bit64
,如下所述:fread() fails with missing values in integer64 columns
我已加载data.table 1.9.5
个NAs
或更高版本的软件包据称显示9218868437227407266s
代替bit64
,但它不起作用。此问题在此处描述,并且是dt[as.character(my_col) == "9218868437227407266", my_col := as.integer64(NA)]
问题:https://github.com/Rdatatable/data.table/issues/488
我把它写成"解决方案":
%>%
它有效,但我想知道如何在dplyr语法中编写它以使用db.events.aggregate(
{$project: {startTime: 1, endTime: 1,matches:
{$cond: [{$and:[
{$lt: ['$startTime',new Date()]},
{$gt: ['$endTime', {$add: [new Date(), '$duration']}]}
]},1,0]}}},
{$match: {matches:1}}
)
而不会发生意外崩溃。
非常感谢提前!
答案 0 :(得分:1)
我们可以使用replace
library(dplyr)
dt %>%
mutate(my_col = replace(my_col, as.character(my_col) == "9218868437227407266",
as.integer64(NA))