Dear all

I have a function in which I would like to change some values to NA according to 
some condition.

dropout<-function(y, nahr=FALSE,...) {

<some stuff for computing an index>

if (nahr) y[index]<<-NA
invisible(index)

}

in case y is a vector all works OK but if it is a part of data frame by calling

dropout(df$y) or dropout(df[,number]) no change is done.

Please can you help me what is wrong with my code?

By the way

idx<-dropout(df$y)
df$y[idx]<-NA

works OK

Thanks a lot beforehand

Best regards.

Petr Pikal
Precheza a.s., Nabř.Dr.E.BeneÜe 24, 750 62 Přerov
tel: +420581 252 257 ; 724 008 364
[EMAIL PROTECTED]; [EMAIL PROTECTED]
fax +420581 252 561

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to