s-news
[Top] [All Lists]

Re: recode

To: Cougar@psu.edu
Subject: Re: recode
From: Spencer Graves <spencer.graves@PDF.COM>
Date: Thu, 20 Mar 2003 09:50:36 -0800
Cc: s-news@lists.biostat.wustl.edu
References: <000c01c2ef07$19ddefe0$3e1a7680@meth.hhdev.psu.edu>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01
How about the following:

tst.data <- data.frame(a=seq(0, 2, length=9), b=seq(0, 2, length=9))
round(tst.data)

Alternatively:

(tst.data>=.5)+(tst.data>1.5)

Do these do work for you?
Best Wishes,
Spencer Graves

Frank Lawrence wrote:
I would like to know how to quickly recode multiple variables.  In one
problem I have, I need to recode the data in a 600 x 200 data frame so that
values less than 0.5 are scored 0, those equal to or greater than 1.5 are
scored 2, and those in between are scored 1.  Using loops seems to take a
very long time.  Is there a more efficient way to accomplish the recode?
WIN 2k, Splus 6.1


Respectfully, Frank R. Lawrence

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news



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