[R] array construction
Poizot Emmanuel
poizot at cnam.fr
Tue Sep 28 09:29:56 CEST 2004
Hi all,
I've got a file of the following format:
X Y Z u v w
0 0 0 x x x
0 0 1 x x x
0 0 2 x x x
.. .. .. .. .. ..
0 1 0 x x x
0 1 1 x x x
0 1 2 x x x
.. .. .. .. .. ..
1 0 0 x x x
1 0 1 x x x
1 0 2 x x x
........ etc
x stand for decimal values
X coordinate is 3h, Y and Z are h length.
I read that file with:
data <- read.table("filename", fill=T)
I extract coordinates with:
coord <- data[1:length,1:3] with length the number of lines of the file
I get the x values with:
values<-data[1:length,4:6]
I would like now to create an 3D array storing the values on the correct
order:
uvw <- array(data[1:length],dim=c(3h,h,h)) with h predifened of course
Is that command correct ?
--
Cordialement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Emmanuel Poizot
Cnam/Intechmer
B.P. 324
50103 Cherbourg Cedex
Tél: (33)(0)233887342
Fax: (33)(0)233887339
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the R-help
mailing list