[R] Vector extracted from a matrix. How can I specify dimensions in as.matrix?

2006-07-27 Thread Neuro LeSuperHéros
Transpose vector extracted from a matrix Hello, I am doing a recursive analysis that uses every line (vector) of a matrix in a loop. In the model, I need to transpose those vectors that are extracted from a matrix. Using simple vectors (no matrix involved) the transpose function works fine:

Re: [R] Vector extracted from a matrix. How can I specify dimensions in as.matrix?

2006-07-27 Thread Gabor Grothendieck
Use the notation x[ , 1, drop = FALSE] See ?[ On 7/27/06, Neuro LeSuperHéros [EMAIL PROTECTED] wrote: Transpose vector extracted from a matrix Hello, I am doing a recursive analysis that uses every line (vector) of a matrix in a loop. In the model, I need to transpose those vectors that are

Re: [R] Vector extracted from a matrix. How can I specify dimensions in as.matrix?

2006-07-27 Thread Cyril Goutte
I think the confusion relates to the fact that in R vectors are not 2D arrays with one dimension set to 1. So your 'simplevector' is not a vector, and your 'extractedvector3x1' and 'extractedvector1x3' are in fact not 3x1 or 1x3, they are 3-element vectors, which sometimes behave like 1x3 arrays,