[R] Making 2 dimensional vector from the 3 dimensional one

Rolf Turner r.turner at auckland.ac.nz
Fri Jul 14 23:57:14 CEST 2017


On 14/07/17 21:43, Csima, Gabriella wrote:

> Hi All,
> I want to make a 1 dimension vector from the first two dimensions of a 3 dimension array, so make a 2 dimension vector from a 3-dimension one, with "fusing" (making as.vector) the first two dimensions.
> It seems to be very easy, but I cannot find the solution, I mean it would very strange, that I would do taking the single 1 dimensional vectors from the 3 dimensional one, make one vector from the first two vectors and make two dimension from the original 3rd one and this new one, but  I think there would be an easier way that I do not find.
> Could you help me, please?
> Thanks very much,

(1) Please avoid posting in HTML (although no great harm was done in 
this instance).  This is a plain text mailing list, and HTML often makes 
a mess.

(2) Spend some time learning R (e.g. read "An Introduction to R" from 
the R web site).  In particular learn about array indexing.

(3) It is not *at all* clear to me what you actually want to do.  A 
simple example of what you've got and what you want to get would help.

(4) What on earth do you mean by "a 1 dimension vector"?  A
1 dimensional vector is a scalar.  I can't believe that this is actually 
what you are talking about.  Please clarify.

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list