R/mdist.R

Defines functions mdist

Documented in mdist

mdist <-
function(x,y){  
	m=length(x)
	n=length(y)
	if(m!=n){
		cat("Error: dimensions do not match","\n")
		return (-1)
	}
	out=0
	for (i in 1:n){
	deltax=as.numeric(I(x[i]!=0))
	deltay=as.numeric(I(y[i]!=0))
	out=out+as.numeric(I(deltax!=deltay))+(x[i]-y[i])^2
	}
	out=sqrt(out)
	return(out)
}

Try the KMDA package in your browser

Any scripts or data that you put into this service are public.

KMDA documentation built on May 30, 2017, 8:11 a.m.