Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.OSF.4.58.0808010112350.58334@wotan.mdacc.tmc.edu>
Date: 2008-08-01T06:14:03Z
From: Paul Roebuck
Subject: Remove Even Number from A Vector
In-Reply-To: <73f827b50807312201m2c1fb6a2q6efd0da3d7b93cf5@mail.gmail.com>

On Fri, 1 Aug 2008, Gundala Viswanath wrote:

> How can I remove the even number from the following vector
>
> > x
> [1]   4   5   6   8  17  20  21  22  23  25  26  31  35  36  38  40  41  42  43
> [20]  44  50  74  75  82  84  89  90  91  95  96  97 100 101 102 118 119 121 122
> [39] 123 135 136 157 158
>
> yielding
>
> 5, 17, 21, 23, 25, ..... (keep odd number).
>

x[which(x %% 2 != 0)]

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)