[R] Re : Re: setting a number of values to NA over a data.frame.

Olivier ETERRADOSSI olivier.eterradossi at ema.fr
Thu Feb 8 13:50:50 CET 2007


Hi again,

Awfully sorry John, I should have been sleeping and did not see your 
full post....

here is a way, unless I miss the point again :

fake<-as.data.frame(cbind(seq(1,10,by=1),c(rep(1,4),rep(0,4),rep(2,2)))) 
# from my previous post

# one moree column this time !
fake3<-cbind(fake,fake$V2)
index<-c(2,3)
fake3[,index][fake3[,index]==0]<-NA

not nice, but seems to do the job.
Hope this helps... this time :-)
Olivier

-- 
Olivier ETERRADOSSI
Maître-Assistant
CMGD / Equipe "Propriétés Psycho-Sensorielles des Matériaux"
Ecole des Mines d'Alès
Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9
tel std: +33 (0)5.59.30.54.25
tel direct: +33 (0)5.59.30.90.35 
fax: +33 (0)5.59.30.63.68
http://www.ema.fr

-------------- next part --------------
An embedded message was scrubbed...
From: Olivier ETERRADOSSI <olivier.eterradossi at ema.fr>
Subject: Re : Re: [R] setting a number of values to NA over  a data.frame.
Date: Thu, 08 Feb 2007 13:21:47 +0100
Size: 1685
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070208/7faa5eef/attachment.mht 


More information about the R-help mailing list