Closed interzonez closed 1 year ago
Thanks for the report. Unfortunately, this isn't a reproducible example. You need to provide the data and the necessary functions for me to be able to run this code. I can't investigate unless you do that.
In case you can't share your code/data, here are some thoughts to help you investigate:
get_unlevered_target_weights()
. It's in get_momo_adjustments()
.TTR::ROC(synthetic_prices, n = formation_period, type = "discrete")
in the call that fails. My guess is that the result does not have any observations... for some reason.You can use options(error=recover)
to make R start the debugger as soon as there's an error. It will give you a chance to step into any function call in the call stack.
Also, you can email me the data and code, if you do not want to share it publicly. Use maintainer('xts')
to get my address.
Error in lag.xts(x, n, na.pad = na.pad) : abs(k) must be less than nrow(x)
This doesn't appear to be a bug in xts
. The message is correct: abs(k)
must be less than the number of available rows. If the user specifies k
greater than nrow(x), then maybe xts
should return a vector with NA
, not an error - this is a bug in user's code, not in xts
.
Closing, since this isn't something that can be fixed by changes in xts' code.
Description
Encountering an error running RMD script:
Error in lag.xts(x, n, na.pad = na.pad) : abs(k) must be less than nrow(x)
In the
get_unlevered_target_weights()
function belowExpected behavior
Script is calculating weights. Below is the current codeblock and the traceback.
Minimal, reproducible example
Session Info