R picks the wrong curly bracket to close my outer loop

14 Views Asked by At

I received a very long R-script with multiple loops and if-statements which I want to run 18 times, for each of my clients. I wanted to put the main part of the script in a loop: for (i in unique_clients){...script with many brackets} but R picks another curly bracket in the script (row 287 instead of 927) to close my loop. Did I forget something? How do I get the entire script to go inside the intended brackets, do I need to indent everything or something? I tried pasting it into the brackets or selecting everything and tabbing a few times but that didn't work.

Hope you can help me! Sorry am still a beginner.

0

There are 0 best solutions below