If you data frame is called 'df'
df$PRODUCTS[df$PRODUCTS > 70] <- NA
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22"
O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1>
On 26/03/07, Sergio Della Franca <sergio.della.franca@gmail.com>
wrote:>
> Dear R-Helpers,
>
> I want to substitute the contents of a variable under some contitions.
>
> I.e., I have this data set:
>
> YEAR PRODUCTS
> 1 80
> 2 90
> 3 50
> 4 60
> 5 30
>
> I want to perform this condition:
> if products> 70 then products=NA else products=products.
>
> I'd like to achive the seguent result:
>
> YEAR PRODUCTS
> 1 NA
> 2 NA
> 3 50
> 4 60
> 5 30
> How can i develop this?
>
>
> Thank you in advance.
>
>
> Sergio Della Franca
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]