count.diff.direction.error {wasim} | R Documentation |
Counts the number of elements for which two vectors show different signs in the derivative.
count.diff.direction.error(x, y)
x |
First vector |
y |
Second vector |
sum((diff(x) / diff(y))<0, na.rm=T)
Dominik Reusser
#All different count.diff.direction.error(1:10,10:1) #One different count.diff.direction.error(1:10,c(1:9, 8))