s-news
[Top] [All Lists]

Re: switch keyword

To: carol white <wht_crl@yahoo.com>
Subject: Re: switch keyword
From: David L Lorenz <lorenz@usgs.gov>
Date: Tue, 9 Oct 2007 12:48:15 -0500
Cc: s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu
In-reply-to: <357352.46088.qm@web62003.mail.re1.yahoo.com>

Carol,
  Take a look at the cut() function.
Dave


carol white <wht_crl@yahoo.com>
Sent by: s-news-owner@lists.biostat.wustl.edu

10/09/2007 09:08 AM

To
s-news@lists.biostat.wustl.edu
cc
Subject
[S] switch keyword





Hi,
I have an integer vector that I want to convert to a categorical vector with values 1, 2, 3.
If the value of an element of the integer vector < 20, then, the value of the corresponding element in the categorical vector will be 1
if the value of an element of the integer vector > 20 and < 50, then, the value of the corresponding element in the categorical vector will be 2
if the value of an element of the integer vector > 50, then, the value of the corresponding element in the categorical vector will be 3

can I do this by switch and how

look forward to your feedback

carol

 


Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!

<Prev in Thread] Current Thread [Next in Thread>