Hi, may be i was not clear when I made this query before.


I have 6 columns in my dataframe (test)


A B C D E F
a b c d 40 30
a f a b 20 10
x m y m 50 30

I want a new column which gets value in E if character value in column A matches with that in column C. One more column comparing B and D. It gets the percentage in F column if value in column B matches the value in D. If it doesn't match, it gets 0 percentage. 

I tried the ?with, ?within and ?ifelse as suggested but am getting the error saying "Error in Ops.factor(test$A, test$C) : level sets of factors are different" How do i fix this ?


Basically I want my result to look like 


A B C D E F new_column_1 new_column_2

a b c d 40 30 0 0

a f a b 20 10 20 0

x m y m 50 30 0 30
thanks
	[[alternative HTML version deleted]]


