Hello everyone. Like others on this list, I'm new to R, and really not much
of a programmer, so please excuse any obtuse questions! I'm trying to
repeat a function across all possible combinations of vectors in a data
frame. I'd hugely appreciate any advice!
Here's what I'm doing:
I have some
Hi
did you find function dist? It seems that it can do directly what you
want.
Regards
Petr
Hello everyone. Like others on this list, I'm new to R, and really not
much
of a programmer, so please excuse any obtuse questions! I'm trying to
repeat a function across all possible
As Petr suggests, the dist() function will do much of the work for you.
For example ...
# example matrix of data
nsamples - 40
nreadings - 46
dat - matrix(runif(nsamples*nreadings), nrow=nsamples)
# Euclidean distance between the ROWS of dat
distance - dist(dat)
Jean
JenniferH
Hi Petr and Jean,
thanks very much, problem solved! Really appreciate your help.
Jennifer
--
View this message in context:
http://r.789695.n4.nabble.com/repeating-a-function-across-a-data-frame-tp4638643p4638678.html
Sent from the R help mailing list archive at Nabble.com.
4 matches
Mail list logo