Ошибка при индексации по строкам data.table со столбцом, содержащим объект интервала из пакета lubridate

У меня есть такие данные (изменено для защиты исходных данных):

View(dose_merged)

SUBJECT_Blinded PACKID  SACDPDAT    SACRTDAT    treatment_interval  TS_SDAT TS_EDAT     SD_SDAT SD_EDAT
1   1201201 10096   2012-04-25  2010-04-22  58  NA  NA  2011-01-03  2013-01-02
2   1101401 10595   2012-01-03  2010-02-31  28  NA  NA  2011-01-03  2013-01-02
3   1201001 10971   2011-11-04  2010-02-03  60  NA  NA  2011-01-03  2013-01-02
4   1201001 12592   2012-03-01  2010-02-25  55  NA  NA  2011-01-03  2013-01-02

С типами столбцов в таблице данных:

> mapply(class, dose_merged)
$SUBJECT_Blinded
[1] "numeric"

$PACKID
[1] "numeric"

$SACDPDAT
[1] "POSIXct" "POSIXt" 

$SACRTDAT
[1] "POSIXct" "POSIXt" 

$treatment_interval
[1] "Interval"
attr(,"package")
[1] "lubridate"

$SD_SDAT

[1] "POSIXct" "POSIXt" 

$SD_EDAT
[1] "POSIXct" "POSIXt" 

Я пытаюсь индексировать по строкам, например:

dose_merged[10:15,]

Затем я получаю сообщение об ошибке:

Error in format(x@start, tz = x@tzone, usetz = TRUE) : 
trying to get slot "start" from an object (class "Interval") that is not an S4 object 

В чем дело?:)

Первые 4 ряда dput(доза_мердж):

 structure(list(SUBJECT_Blinded = c(2222001, 2201001, 2201001, 
 2222022), PACKID = c(10096, 10595, 10971, 12592), SACDPDAT = structure(c(1335304800, 
 1325545200, 1320361200, 1330556400), class = c("POSIXct", "POSIXt"
 ), tzone = ""), SACRTDAT = structure(c(1340316000, 1327964400, 
 1325545200, 1335304800), class = c("POSIXct", "POSIXt"), tzone = ""), 
treatment_interval = structure(c(58, 28, 60, 55), class = structure("Interval", package = "lubridate")), 
TS_SDAT = structure(c(NA_real_, NA_real_, NA_real_, NA_real_
), class = c("POSIXct", "POSIXt"), tzone = ""), TS_EDAT = structure(c(NA_real_, 
NA_real_, NA_real_, NA_real_), class = c("POSIXct", "POSIXt"
), tzone = ""), SD_SDAT = structure(c(1325545200, 1325545200, 
1325545200, 1325545200), class = c("POSIXct", "POSIXt"), tzone = ""), 
SD_EDAT = structure(c(1357081200, 1357081200, 1357081200, 
1357081200), class = c("POSIXct", "POSIXt"), tzone = "")), .Names = c("SUBJECT_Blinded", 
"PACKID", "SACDPDAT", "SACRTDAT", "treatment_interval", "TS_SDAT", 
"TS_EDAT", "SD_SDAT", "SD_EDAT"), sorted = "SUBJECT_Blinded", class = c("data.table", 
"data.frame"), row.names = c(NA, -4L), .internal.selfref = <pointer: 0x0000000000300788>)

0 ответов

Другие вопросы по тегам