search for: folds2

Displaying 1 result from an estimated 1 matches for "folds2".

Did you mean: folds
2008 Jun 04
5
help understanding why #function(x, y) (if((x-y)>=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should
...heck2<-cbind(x1,y1,z1) View(check2) Warning message: In if ((x - y) >= 0) { : the condition has length > 1 and only the first element will be used ################################################################################ #### loop I am trying to avoid writing many many times ##### folds2<-NULL xy<-as.data.frame(cbind(x,y)) for (i in 1:nrow(xy)) { diff<-xy$x[i]-xy$y[i] folds2[i]<-if(diff>=0) {2^diff} else{-(2^abs(diff))} } xyz<-cbind(xy,folds2) View(xyz) ################# Thank you, Alan P.S. why does ?function not work