Re: [R] If then else with command for

2010-09-14 Thread steven mosher
not sure how you wanted sampling of x R<-142 color<-rep(0,142) for(i in 1:R){ y<-sample(x,142,replace=FALSE) onebit<- as.numeric(3471 %in% y) twobit<-as.numeric(6720 %in% y)*2 fourbit<-as.numeric(6263 %in% y)*4 colorbit<-onebit+twobit+fourbit+1 color[i]<-colorbit } On Tue, Sep 14, 2010

Re: [R] If then else with command for

2010-09-14 Thread Henrique Dallazuanna
Try this: x <- c(288,139,196,159,536,134,623,517,96,467,277,155,386,241,422,6263,612,532,250,412,339,55,290,249,164,97,74,144,1277,240,163,63,488,111,128,230,720,179,37,24,65,37,89,187,60,939,1008,81,310,58,169,38,68,190,78,807,220,226,69,179129,119,73,59,92,127,104,75,505,183,49,41,76,113,90,79,4

Re: [R] If then else with command for

2010-09-14 Thread Mestat
Yep... Got that... I just changed my data name... It worked fine... Thanks... -- View this message in context: http://r.789695.n4.nabble.com/If-then-else-with-command-for-tp2539341p2539429.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] If then else with command for

2010-09-14 Thread Adrienne Wootten
Marcio, Try this instead: x<-c(288,139,196,159,536,134,623,517,96,467,277,155,386,241,422,6263,612,532,250,412,339,55,290,249,164,97,74,144,1277,240,163,63,488,111,128,230,720,179,37,24,65,37,89,187,60,939,1008,81,310,58,169,38,68,190,78,807,220,226,69,179129,119,73,59,92,127,104,75,505,183,49,41

[R] If then else with command for

2010-09-14 Thread Mestat
Hey listers, I am trying to do something simple... Check the program below... I would like to create a variable named COLOR according to the conditions that I stablished... But the problem is that it seems that my variable COLOR is checking just on sample, may be last in the loop... Certainly, I a