[R] Matrix in a Reverse order
Benilton Carvalho
beniltoncarvalho at gmail.com
Thu Feb 18 12:48:28 CET 2010
x[nrow(x):1,]
b
On Thu, Feb 18, 2010 at 11:45 AM, Amelia Livington
<amelia_livington at yahoo.com> wrote:
> Dear 'R' friends
>
> I have a sort of stupid question to ask.
>
> I have a matrix say of the order 4 X 3 as
>
> 83 98 90
> 21 83 84
> 70 39 56
> 65 29 38
>
> Is there any command in R which will reverse the order i.e. I need to have same 4 X 3 matrix but as given below
>
> 65 29 38
> 70 39 56
> 21 83 84
> 83 98 90
>
> i.e. the last row becomes first row, second - last row becomes second row and so on. I need this to allign it with some other variable set.
>
> Thanks
>
> Amelia
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>
More information about the R-help
mailing list