3
I’m making a for
in my script, but in the last line when I run models$i
, I needed that one i
was the value of my i
of for
, would have been able to do?
for(i in x){
maxit <- as.integer(1000000)
algoritmo <- neuralnet(dados2016[,5] ~ dados2016[,4],
data <- dados2016, hidden=i ,threshold=1, stepmax=maxit)
teste <- compute(algoritmo, dados2017[,4])
precos$weight[] <- NA
precos$weight[] <- if(dados2017[,4] < teste$net.result[,1], 1, 0)
models$i <- bt.run.share(precos, clean.signal=T)
}
Your code is not reproducible. For example, we do not know what it is
x
, what packages the commands came out ofneuralnet
and what is the output of the commandbt.run.share
. We also don’t know what error appears when the code is executed. I recommend editing the question so that someone who wants to help you can copy and paste your code to run on their own computer.– Marcus Nunes
If you want to access column i, the correct ones are models[ ,i]
– TheBiro
You probably have to access with
[[
:models[[i]]
– Luiz Rodrigo