[R] Replacing a value in a dataframe

2011-11-30 Thread arunkumar1111
hi I have data like this in a dataframe Var Value Cheque X140FALSE X220FALSE X328TRUE I want to replace it FLASE with 0 and TRUE with 1. is there any method by which i can do without using LOOP -- View this message in context:

Re: [R] Replacing a value in a dataframe

2011-11-30 Thread Uwe Ligges
On 30.11.2011 09:16, arunkumar wrote: hi I have data like this in a dataframe Var Value Cheque X140FALSE X220FALSE X328TRUE I want to replace it FLASE with 0 and TRUE with 1. is there any method by which i can do without using LOOP dataframe$Cheque -

Re: [R] Replacing a value in a dataframe

2011-11-30 Thread Bert Gunter
er... Uwe, shouldn't that be, e.g. dataframe$Cheque - as.integer(dataframe$Cheque) ## or building on Rolf's suggestion dataframe - within(dataframe, Cheque - as.integer(Cheque)) While I am at it, is there any practical difference in efficiency between these two approaches? -- Bert

Re: [R] Replacing a value in a dataframe

2011-11-30 Thread Uwe Ligges
On 30.11.2011 12:26, Bert Gunter wrote: er... Uwe, shouldn't that be, e.g. dataframe$Cheque- as.integer(dataframe$Cheque) Sure, thanks. ## or building on Rolf's suggestion dataframe- within(dataframe, Cheque- as.integer(Cheque)) While I am at it, is there any practical difference in