[R] replace values but different replacement length

Spencer Graves spencer.graves at pdf.com
Fri Jul 2 17:22:01 CEST 2004


      What are the lengths of

match02$BL02DATE[is.na(match02$BL02DATE)] and match02$BLOCKED?  

	  In particular, have you considered the following:  

match02$BL02DATE[is.na(match02$BL02DATE)] <-  match02$BLOCKED[is.na(match02$BL02DATE)]


      hope this helps.  spencer graves

Christian Schulz wrote:

>Hi,
>
>have anybody a hint/help how it's possible replace i.e.
>the NA values  from BL02DATE with  non-Missing 
>values from BLOCKED  and vice versa. 
>Both variables are with an id  in a 188.249 rows data.frame and
>my fr function didn't count the NA's.
>
>Many thanks 
>Christian
>
>
>  
>
>>>fr(BL02DATE)
>>>      
>>>
>       Count Prcnt
>1     140660  84.6 
>2      25589  15.4 
>Total 166249 100.0
>
>  
>
>>>fr(BLOCKED)
>>>      
>>>
>       Count Prcnt
>1     151982  85.4 
>2      25976  14.6 
>Total 177958 100.0
>
>  
>
>>>match02$BL02DATE[is.na(match02$BL02DATE)] <-  match02$BLOCKED
>>>      
>>>
>Warning message: number of items to replace is not a multiple of
>replacement length
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>




More information about the R-help mailing list