[R] Replacing null values

David Winsemius dwinsemius at comcast.net
Sat Jul 30 17:45:21 CEST 2011


On Jul 30, 2011, at 2:25 AM, Jeffrey Joh wrote:
>
> I would like to reorder a two-column table by column A, then fill  
> column B with the values above it.  For example: Original:A   B2    
> 545   NA8   784   NULL3   269   NULL First sort by column A:A      
> B2     543     264     NULL5     NA8     789     NULL Then replace  
> null/na values in column B with the value above it:A         
> B2        543     264     265     268        789     78 What is the  
> best way to do this?Jeff 		 	   		
> 	[[alternative HTML version deleted]]

The "best way to do this" meaning to get help on _this_ mailing list,  
is to post in plain text and to post the results of dput() on this  
"two-column table".

All this is explained here:
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list