[R] Reversing order of vector

Kenn Konstabel lebatsnok at gmail.com
Tue Mar 29 09:27:56 CEST 2011


On Tue, Mar 29, 2011 at 10:20 AM, Vincy Pyne <vincy_pyne at yahoo.ca> wrote:
> Dear R helpers
>
> Suppose I have a vector as
>
> vect1 = as.character(c("ABC", "XYZ", "LMN", "DEF"))
>
>> vect1
> [1] "ABC" "XYZ" "LMN" "DEF"
>
> I want to reverse the order of this vector as
>
> vect2 = c("DEF", "LMN", "XYZ", "ABC")

rev(vect1)

> Kindly guide
>
> Regards
>
> Vincy
>
>
>
>
>
>
>        [[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