Vectorize a product calculation which depends on previous elements?

前端 未结 7 1998
小鲜肉
小鲜肉 2020-12-04 22:23

I\'m trying to speed up/vectorize some calculations in a time series. Can I vectorize a calculation in a for loop which can depend on results from an earlier iteration? For

7条回答
  •  难免孤独
    2020-12-04 23:06

    It's also possible to do this with "apply" using the original vector and a lagged version of the vector as the constituent columns of a data frame.

提交回复
热议问题