Re: [R] Reversing order of vector

From: Philipp Pagel <p.pagel_at_wzw.tum.de>
Date: Tue, 29 Mar 2011 09:44:22 +0200

On Tue, Mar 29, 2011 at 12:20:50AM -0700, Vincy Pyne wrote:
>
> vect1 = as.character(c("ABC", "XYZ", "LMN", "DEF"))

as.character is unnecessary, here.

> > vect1
> [1] "ABC" "XYZ" "LMN" "DEF"
>
> I want to reverse the order of this vector as
>
> vect2 = c("DEF", "LMN", "XYZ", "ABC")

vect2 <- rev(vect1))

cu

        Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/

______________________________________________
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.
Received on Tue 29 Mar 2011 - 07:46:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Mar 2011 - 08:50:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive