| To: | "Walter R. Paczkowski" <dataanalytics@earthlink.net> |
|---|---|
| Subject: | Re: reversing a scale |
| From: | Sundar Dorai-Raj <sundar.dorai-raj@pdf.com> |
| Date: | Fri, 18 Aug 2006 12:34:16 -0500 |
| Cc: | s-news@lists.biostat.wustl.edu |
| In-reply-to: | <7.0.1.0.2.20060818131329.034347e8@earthlink.net> |
| Organization: | PDF Solutions, Inc. |
| References: | <7.0.1.0.2.20060818131329.034347e8@earthlink.net> |
| User-agent: | Mozilla Thunderbird 1.0.2 (Windows/20050317) |
How about: x <- c(5, 1, 3, 4, 2, 1, 1, 5) y <- 6 - x --sundar Walter R. Paczkowski wrote: Hi,I'm looking for a simple way to convert a scale such as 1, 2, 3, 4, 5 to 5, 4, 3, 2, 1. In other words, I want to map1 --> 5 2 --> 4 3 --> 3 4 --> 2 5 --> 1So if I have a vector (5, 1, 3, 4, 2, 1, 1, 5), I want to map it to a new vector (1, 5, 3, 2, 4, 5, 5, 1). I've been using ifelse statements which works but if my scale is, say, 1:100, then I have 100 nested statements - that's not good. Any suggestions?Thanks, Walt Paczkowski _________________________________ Walter R. Paczkowski, Ph.D. Data Analytics Corp. 44 Hamilton Lane Plainsboro, NJ 08536 (V) 609-936-8999 (F) 609-936-3733 |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: reversing a scale, Chuck Cleland |
|---|---|
| Next by Date: | reversing a scale, Walter R. Paczkowski |
| Previous by Thread: | Re: reversing a scale, Chuck Cleland |
| Next by Thread: | reversing a scale, Walter R. Paczkowski |
| Indexes: | [Date] [Thread] [Top] [All Lists] |