Skip to content
Prev 82739 / 398506 Next

help with writing function

Hi

or use outer

x<-1:10
x<-sample(x)
mat<-outer(x,x,"-") # result with zeroes
matrix(mat[!mat==0],9,9) # get rid of them

will give you a matrix with columns with intended result.

HTH
Petr
On 13 Dec 2005 at 11:53, Robert Burrows wrote:
Date sent:      	Tue, 13 Dec 2005 11:53:00 -0500 (EST)
From:           	Robert Burrows <rbb at nebiometrics.com>
To:             	Oarabile Molaodi <oarabile at stams.strath.ac.uk>
Copies to:      	r-help at stat.math.ethz.ch
Subject:        	Re: [R] help with writing function
Petr Pikal
petr.pikal at precheza.cz