Without a minimal working example see the FAQ, more concrete guidance would require reverse engineering the problem, so I'll offer some general guidance.

Every problem in `R`

can be approached with advantage with school algebra in mind: f(x) = y, where the three objects, f, x, y (in `R`

*everything* is an object) are

x what is at hand

y what is desired

f a function to convert x to y

Each of these objects may be, and in the case of this problem are, composite, consisting of other objects. In particular, f will be analogous to f(g(x).

For the problem

x the [unknown for purposes of the question] object `[redes]`

on 20 `tibbles`

for each of 4 networks [of unknown object type] repeated over 5 network objects

y is a table of results

g performs an operation [unknown for the purposes of this question] on each network using some or all parts of each tibble that extracts the results desired

f collects the return values of g and records them in y.

While it is possible to do this with the `for`

function, procedural/imperative programming style is not `R`

's long suit. For this type of problem, `apply`

, `sapply`

, `lapply`

or its `purrr`

front ends in its `map`

family are preferred.

To proceed without a `reprex`

, compose f and g to deal with the single case of one repetition of one network on one tibble. By running the ANN-related tests and placing them in the receiver object y.

Recall that, since functions are first-class objects, they may be given as arguments to other functions. This has two applications: first, h = f(g(x); second m(h(z)$ will operate over k_i ...k_n, j_i ... k_n where z is some object that encapsulates the indices i and j.