When expand is called on a win_tbl, values are repeated for all time-steps that fall into the interval starting at index_var and lasting until index_var + dur_var. This works when index_var + dur_var is a positive number but whenever it's negative, it is just set to 0 by the following code.
The effect of this can be seen with the following example from gcs. Here, ett_gcs is processed with expand but this leads to falls results for some patients.
When expand is called on a
win_tbl
, values are repeated for all time-steps that fall into the interval starting atindex_var
and lasting untilindex_var + dur_var
. This works whenindex_var + dur_var
is a positive number but whenever it's negative, it is just set to0
by the following code.https://github.com/eth-mds/ricu/blob/7f2cc42503e003f4aea388847232e4157b7fc8ea/R/utils-ts.R#L140-L148
The effect of this can be seen with the following example from
gcs
. Here,ett_gcs
is processed withexpand
but this leads to falls results for some patients.Created on 2024-04-12 with reprex v2.1.0
It is not entirey clear to me why
end_var
would need to be set to zero in the below code.https://github.com/eth-mds/ricu/blob/7f2cc42503e003f4aea388847232e4157b7fc8ea/R/utils-ts.R#L146-L147
Maybe the intent was to prevent negative
dur_var
s? In that case, the following code would be needed instead.