[R] basic help
    מוטי אסולין 
    moti at hizun.co.il
       
    Thu Mar 20 05:59:39 CET 2008
    
    
  
Hi,
I am a new R user (used SPSS for many years) and I need help. 
I have a data frame mydata with 8 variables m2008:m2001
I wanted to add a new variable mydata$firstvalid that tells me what is the
first non missing variable for each case (without using for-next).
I tried many variations of this: 
lst  = paste("m",2008:2001,sep="")
mydata$firstvalid = match(FALSE, is.na(mydata[lst]),0)
Instead of a different value for each case, I get the same value for all
cases - the first non missing value in the whole data frame.
Many thanks,
Moti Assouline 
 
 
Checked by AVG. 
20:52
    
    
More information about the R-help
mailing list