I have a dataset with n rows and k columns I want to iterate over. What is the recommended way?
Currently I would first create a n x k Matrix and then do two nested for-loops. I heard column wise is best
for col in 1:k
for row in 1:n
...
end
end
I heard so that functions like eachindex() and objects like CartesianIndex exist and I’d love to understand how to use them better. Eachindex loses the row and col information. CartesianIndex I was not able to properly use.
(1) Which collection to choose. Is Matrix okay?
(2) Are there more simple ways to iterate over a collection while maintaining (a) the row and col indices, (b) the matrix index, (c) both
(3) What are Cartesian Indices and how/when to use them?