1

I get the following error message:

Error in if (sum(c(new$hour, new$min, new$sec))) { : 
  argument is not interpretable as logical

when I execute the following code:

keep$EstimateDate <- as.Date(keep$date + keep$days,"%Y-%m-%d")
keep$EstimateDateWeekStart <- floor_date(keep$EstimateDate,"week") #+1

The keep$EstimateDate is a column in a data.table with properly formatted dates.

The floor_date() is a function in the lubridate package.

4

1 回答 1

4

我能想到的唯一一种情况是你在哪里出现错误if但没有sum出现NA在你的总和中。考虑到这一点,这很可能是正在发生的事情:

floor_date(as.Date(NA), "week")
#Error in if (sum(c(new$hour, new$min, new$sec))) { : 
#  argument is not interpretable as logical

换句话说,检查你没有任何NA's.

于 2013-05-28T19:35:54.683 回答