# for-loop

1. ### iteration using a loop in R

Hi, I have two vectors as follows: popd = vector(mode='numeric', 100) popr = vector(mode='numeric', 100) These represent the initial distribution within 2 populations. I want to define these e.g. popd[]=0.01 popr[]=0.01 These populations will then transform according to the following...
2. ### Loops (problem)

Hi, I am new to R and having problems with understanding loops in R. basically what i want is the following say i have a variable y with 100 observations I want y1 = first 20 observations y2 = second 20 obs y3 = third 20 obs and so on until y5 i know i can do that with y1 <- c(y[1:20])...
3. ### 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...