[R] Loop to check for large dataset

Christoph Puschmann c.puschmann at student.unsw.edu.au
Fri Oct 7 22:22:59 CEST 2016


Hey all,

I would like to know if anyone, can put in the right direction of the following problem:

I am currently want to use it to check if a column with a length of 61327 is consistent over an 1 to 157 interval until the end of the column. In the case the interval is interrupted I want to know which values are missing and where the missing values are located. I started of with the following code to assign 1s, if we have a number ≤ 157 and 0 if not.



I tried to do a double loop:



    n=61327
    Control = matrix(
    0,
    nrow = n,
    ncol = 1)



    for (i in length(FD$WEEK)) {
    for (j in 1:157) {
    if(FD$WEEK[j] <=  157) {
      Control[,1] = 1
    } else {
      Control[,1] = 0
      }
    }
    }



I believe that this code is not correct, but I am unable to wrap my head around how I can check that the interval always will be followed.

All the best,

Christoph


	[[alternative HTML version deleted]]



More information about the R-help mailing list