while-loop

  1. S

    While-loop (with an example)

    Hello! I am trying to understand the concepts of while-loops for programming, and was watching this tutorial on youtube. The example was given in Matlab (which I believe has a similar syntax to R): bal = 5000; year = 0; while bal<1000000 bal = 1.08*bal + 5000; year = year + 1; end...
  2. L

    really complicated: how to cumulate one variable in function of the CHANGE in another

    Hello everybody! I got a SPSS file with the variables "user-id" "date" and than certain information about his consumer behaviour and payments for this particular month. I now want to calculate -for example- the overall amount spent by every customer. The user-ids are not consecutive...