[R] A matrix calculation
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Sun Aug 23 21:06:18 CEST 2009
Bogaso wrote:
> No no, I actually want following result :
>
> 7, 14, 21, 6, 13, 20, 5, 12, 19,............
c(t(mat[7:1,])) then.
>
>
>
>
> David Winsemius wrote:
>>
>> On Aug 23, 2009, at 2:37 PM, Bogaso wrote:
>>
>>> I have suppose a matrix like that
>>>
>>>> mat <- matrix(1:21, 7)
>>>> mat
>>> [,1] [,2] [,3]
>>> [1,] 1 8 15
>>> [2,] 2 9 16
>>> [3,] 3 10 17
>>> [4,] 4 11 18
>>> [5,] 5 12 19
>>> [6,] 6 13 20
>>> [7,] 7 14 21
>>>
>>>> From this matrix, I want to create a vector like tha :
>>> c(mat[7,], mat[6,], mat[5,], ....., mat[1,])
>>>
>>> Can anyone please guide me, how to do that?
>> c( mat[7:1,] )
>>
>> # [1] 7 6 5 4 3 2 1 14 13 12 11 10 9 8 21 20 19 18 17 16 15
>>
>> --
>>
>> David Winsemius, MD
>> Heritage Laboratories
>> West Hartford, CT
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list