Re: [R] creating a new vecotr in a for loop

2008-11-25 Thread Jorge Ivan Velez
Dear PDXRugger, If I understand correctly, try this: # Data x = c(1:5,1,4,7) # Option 1 require(car) y1=recode(x, "1=4; 4=2; 7=3") # Option 2 y2=ifelse(x==1,4, ifelse(x==4,2, ifelse(x==7,3,x))) # Are y1 and y2 equals? all.equal(y1,y2) # Ordering x by y1 x[order(y1)] See ?order, ?ifelse and ?r

Re: [R] creating a new vecotr in a for loop

2008-11-25 Thread Charles C. Berry
See ?is.element ?order and perhaps ?ave and PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. as it says on your own email! What you provide is not reproducible. HTH,