Hi!
I am trying to create an iteration (2 for-loops) based on a data frame of 2 col and 25 rows.
I have created a new date frame that countain the position of
all bacterias for each iteration (120 iterations). So I now have a data frame of 240 col (x1, y1, x2, y2, x3, y3...) and 25 rows. all 25 bacteria should move at the same time.
I am trying to create a GIF of all the changing position. This part, I think is correct :
# Création des fichiers .png
png(file="EX.png", width=200, height=200)
for (iter in 1:max_iteration){
plot.new()
text(.5, .5, i, cex = 6)
}
dev.off()
# Conversion des fichiers .png en un seul fichier .gif avec ImageMagick
system("convert -delay 80 *.png EX.gif")
# On supprime les fichiers .png
file.remove(list.files(pattern=".png"))
However, I cannot figure out how to arrange my 2 for-loops. I would like to produce and save as many plots as there are iterations (120).
My question is: it possible to create a for loop extracting only 2 column at a time? So for the first iteration columns 1 and 2, for iteration 2 columns 3 and 4 ... etc. ?