I know this is going to be a dumb question but... I need a cube like struture , I have 3 dimensions well defined which I need to define a value in the cube something like Cube [][][] in C+ ou Java ... I have thought in making a matrix and then an array... and even the other way around. The problem is that the I have the indexs and wanted to access direcly the element both reading or writing without to much effort.... But how can "access" a specific number only by their index ? of course It is possible to make a specific calc in order to reach the place I needed .... But what for ? if I have the correct indexs directly ? Is "R" capable of building such a struture besides adding up matrixes and or arrays ? Did I miss anything ? Thanks in advance Marco Marques
Have you gone through `An Introduction to R', or even ?array? Try: mycube = array(1:27, c(3, 3, 3)) mycube[1, 2, 3] mycube[2, , ] mycube[, 2, ] etc. Andy> From: MMarques Power > > > I know this is going to be a dumb question but... > I need a cube like struture , I have 3 dimensions well defined which > I need to define a value in the cube something like > Cube [][][] in C+ ou Java ... > I have thought in making a matrix and then an array... > and even the other way around. > The problem is that the I have the indexs and wanted to access direcly > the element both reading or writing without to much effort.... > > But how can "access" a specific number only by their index ? > of course It is possible to make a specific calc in order to reach the > place I needed .... > But what for ? if I have the correct indexs directly ? > > Is "R" capable of building such a struture besides adding up > matrixes and or arrays ? > Did I miss anything ? > > Thanks in advance > Marco Marques > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}
MMarques Power wrote:> I know this is going to be a dumb question but... > I need a cube like struture , I have 3 dimensions well defined which > I need to define a value in the cube something like > Cube [][][] in C+ ou Java ... > I have thought in making a matrix and then an array... > and even the other way around. > The problem is that the I have the indexs and wanted to access direcly > the element both reading or writing without to much effort.... > > But how can "access" a specific number only by their index ? > of course It is possible to make a specific calc in order to reach the > place I needed .... > But what for ? if I have the correct indexs directly ? > > Is "R" capable of building such a struture besides adding up > matrixes and or arrays ? > Did I miss anything ? > > Thanks in advance > Marco Marques >You can index a 3d array A with A[x,y,z] Uwe Ligges