[R] Odp: conditional data replace (recode, change or whatsoever)

zcatav zcatav at gmail.com
Wed Aug 3 13:02:42 CEST 2011


Petr Pikal wrote:
> 
> Hi
> I believe there are better solutions but I would use two steps
> 
> select rows where c==0 (see also FAQ 7.31)
> sel<-which(big.data.frame$c==0)
> 
> change NA values in b column based on sel
> big.data.frame$b[sel][is.na(big.data.frame$b[sel])]<-"20011-07-28"
> 
> Beware of data types AFAIK R can not accept "20011-07-28" as a date.
> 
> Regards
> Petr
> 
> 

Thanks, it runs like a charm.
Replaced date format just a typo.

--
View this message in context: http://r.789695.n4.nabble.com/conditional-data-replace-recode-change-or-whatsoever-tp3714715p3715080.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list