s-news
[Top] [All Lists]

Re:

To: "Khan, Sohail" <khan@cshl.edu>,
Subject: Re:
From: John Fox <jfox@mcmaster.ca>
Date: Mon, 29 Sep 2003 10:19:11 -0400
Cc: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
In-reply-to: <5F7E863301E72846B90A4CEBB15EAE661F58FC@exch02>
Dear Sohail,

For example, for the variable x in data frame df,

df$x[df$x <= 0] <- 0

I hope that this helps,
 John

At 09:22 AM 9/29/2003 -0400, Khan, Sohail wrote:
Hi,
I am new to S language.  I need to write a function which would replace all
values < 0 in a column(data.frame) with 0.
Thanks

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox@mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------


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