s-news
[Top] [All Lists]

Replacing NA with a particular value

To: <s-news@lists.biostat.wustl.edu>
Subject: Replacing NA with a particular value
From: "Khan, Sohail" <khan@cshl.edu>
Date: Wed, 22 Feb 2006 23:14:31 -0500
Thread-index: AcY4MTalq4r44DgjTTiyuBR3/rswxw==
Thread-topic: Replacing NA with a particular value
Dear list,

I have a data frame as:

chr     chr.pos         abs.pos         ratio
1       2500            3600            0.25
1       5600            7500            NA
2       1450            5200            NA
2       5000            7005            NA
2       6480            8754            0.25
2       5425            6542            NA
2       6000            8963            NA
2       6542            9512            0.32

I would like to replace the NAs only if they occur in between the same values, 
in the data set above replace NA between 0.25 with 0.25, and leave the NA 
between 0.25 and 0.32.  Any help is greatly appreciated.

-Sohail

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