[R] substitute variable

2007-03-26 Thread Sergio Della Franca
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.

Re: [R] substitute variable

2007-03-26 Thread Henrique Dallazuanna
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 Ohttp://maps.google.com/maps?f=qhl=enq=Curitiba,+Brazillayer=ie=UTF8z=18ll=-25.448315,-49.276916spn=0.002054,0.005407t=kom=1 On 26/03/07, Sergio Della

Re: [R] substitute variable

2007-03-26 Thread Benilton Carvalho
say your data frame is called tmp tmp$PRODUCTS[tmp$PRODUCTS 70] - NA b On Mar 26, 2007, at 12:31 PM, Sergio Della Franca 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

Re: [R] substitute variable

2007-03-26 Thread Sergio Della Franca
Ok, this run correctly. Now i want to perform much more conditions, i.e.: tmp$PRODUCTS[tmp$PRODUCTS 70] - NA and tmp$PRODUCTS[tmp$PRODUCTS 20] - NA. How can i perform this double condition in the same code? 2007/3/26, Benilton Carvalho [EMAIL PROTECTED]: say your data frame is called

Re: [R] substitute variable

2007-03-26 Thread Benilton Carvalho
condition1 | condition2 (or) condition1 condition2 (and) tmp$PRODUCTS[tmp$PRODUCTS 70 | tmp$PRODUCTS 20] - NA b On Mar 26, 2007, at 12:47 PM, Sergio Della Franca wrote: Ok, this run correctly. Now i want to perform much more conditions, i.e.: tmp$PRODUCTS[tmp$PRODUCTS 70] - NA and