[R] if else lop

gary engstrom
2011-07-05T20:27:41Z

I am trying to use if...else loop and have included a code snippet which I

  might like to expand.
  Maybe you could steer me in the right direction.
  library(stats)
  library(prob)
  {
   a <- sample ( 1:4,100, replace=T,prob=c(0.1,0.2,0.5,0.3))
  b<-sample(3:6,100,replace=T,prob=c(0.2,0.2,0.2,0.4))
  }
  dd <- data.frame(a,b)
  if (subset finds a vector) ( print that vector)
  (else continue looking at subsets)
  subset(dd,isin(dd,c(1,4), ordered = FALSE))
  subset(dd,isin(dd,c(3,3),ordered=F))
  Thank you
  G