I have to calculate multiple of comparison in values between 2 rows.

a <- c(1, 2,3,4,5,6)
b <- c(3,1,2,8,3,8)
c <- rbind(a,b)

Expected Output

D <- 3 2 1.5 2 1.6 1.3
i.e Numbers of times values of "a" is more or less than values of "b"

Please make effort to clearly describe your issue.
Please use words to describe the mathematics to create D from a and b ?

Original question edit as needed.

Do you mean for any number a and b, find the largest number, then divide it by the smaller number ?

Yes, I want the same.

a <- c(1, 2,3,4,5,6)
b <- c(3,1,2,8,3,8)

round(ifelse(a>=b,a/b,b/a) ,digits=1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.