How to represent a list of points in R
Posted
by Guido
on Stack Overflow
See other posts from Stack Overflow
or by Guido
Published on 2010-05-03T19:39:23Z
Indexed on
2010/05/03
19:48 UTC
Read the original article
Hit count: 161
r
|data-structures
I am working with a large list of points (each point has three dimensions x,y,z).
I am pretty new with R, so I would like to know what is the best way to represent that kind of information. As far as I know, an array allows me to represent any multidimensional data, so currently I am using:
> points<-array( c(1,2,0,1,3,0,2,4,0,2,5,0,2,7,0,3,8,0), dim=c(3,6) )
> points
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 1 2 2 2 3 -- x dim
[2,] 2 3 4 5 7 8 -- y dim
[3,] 0 0 0 0 0 0 -- z dim
The aim is to perform some computations to calculate the euclidean distance between two sets of points (any hint in this sense would also be highly appreciated)
© Stack Overflow or respective owner