Hi,

 

In a symmetric design one may have a data.frame with, say, two factors (two
columns), each one with  n  levels.

 

In a nested loop, to run a expression combining levels of each factors, to
produce a new data.frame, if one level is absent, the loop is interrupted;
one gets a empty object.

 

Is there a way to avoid or skip combinations of factors in such nested
loops?

 

I think that the approach below is a very crude example:

 

for(i in unique(DF$ID1)) #! For each ID1 level

{

  for (e in unique(DF$ID2)) #! For each ID2 level

  {

    DF.N <- DF[DF$ID1==i & DF$ID2==e,]

    if(nrow(DF.N)==0) DF2 <- ??

      else

                

 

Any idea will be welcome

 

Paulo


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to