spatcen <-
function(x){
#
# compute spatial median
# x is an n by p matrix
#
if(!is.matrix(x))stop("x must be a matrix")
x<-elimna(x)
START<-apply(x,2,median)
val=optim(START,spat.sub,x=x,method='BFGS')$par
list(center=val)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.