<!--startrecall--><img src="http://mail.skku.edu/mail/write/mail_recall.php?f_headindex=1215810-2003022633787-R-help@stat.math.ethz.ch"><!--endrecall--> Hello! I have a question on rank function that i'm working on now. Even though my English i not good, I hope you understand what i'm asking for. It is a program that i made (It must not to use the function from the R) ########################## data<-sample(c(1:100),10) rank.data <- rep(0,length(data)) for(i in 1:length(data)){ for(j in 1:length(data)){ if(data[i]<data[j]){ rank.data[j] <- rank.data[j] + 1 } } } rank.data <- rank.data + 1 data rank.data rank(data) ########################## I wrote out again because i wanted to decrease it to 55times for efficiency of calculation. ######################### data<-sample(c(1:100),10) test.data<-data n<-length(data) min.data<-1000 for(j in 1:10){ for(i in 1:n){ if(data[i]<min.data){ min.data <- data[i] }} rank.data[rank.data==min.data]<-j data <- data[data!=min.data] } test.data rank.data rank(test.data) ######################### ### This is output ###### Error in if (data[i] < min.data) { : missing value where TRUE/FALSE needed > test.data [1] 97 25 90 76 85 32 79 8 39 35 > rank.data [1] 3 9 7 4 6 95 1 1 1 5 > rank(test.data) [1] 10 2 9 6 8 3 7 1 5 4 > I added it to R after i copied the sources then error occured instead of the result that i wanted. How can i get the correct results? And how can i correct second source? [[alternative HTML version deleted]]