You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prtf <- optimize.portfolio(asset_returns, portfolio = base_pf, optimize_method = c("DEoptim"), search_size = search_size, itermax = 50, traceDE=20, trace=T)
I will build an API using this, so no, I cannot just put the number in there, it comes from outside the script.
I've tried to put it into a numeric vector and extract the number from it, tried to itermax = as.numeric(itermax)
but absolutely no success.
I get a non-numeric argument to binary operator error.
my guess is that you are experiencing a scoping and lazy evaluation problem, and by the time itermax is evaluated, it has been reset somewhere to a default, but if you use a different variable name, when it is evaluated it will always be your value.
can't seem to pass a value into the itermax argument.
This does not work
and this works just fine
prtf <- optimize.portfolio(asset_returns, portfolio = base_pf, optimize_method = c("DEoptim"), search_size = search_size, itermax = 50, traceDE=20, trace=T)
I will build an API using this, so no, I cannot just put the number in there, it comes from outside the script.
I've tried to put it into a numeric vector and extract the number from it, tried to
itermax = as.numeric(itermax)
but absolutely no success.
I get a
non-numeric argument to binary operator
error.What could possibly be the cause of this misinterpretation of the optimize function? Thanks!
The text was updated successfully, but these errors were encountered: