Have a look at the documentation for ifelse() http://stat.ethz.ch/R-manual/R-devel/library/base/html/ifelse.html that should do what you need.
Rhydwyn -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sapana Lohani Sent: Wednesday, August 29, 2012 10:06 AM To: R help Subject: [R] Use or ?? Hi, My data frame looks like A B C a b a x y z I want to add a new column which says "y" if either A or B matches with C and "n" if there is no match. How can I do that? Thanks [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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. ########################################################################################################################################################################################################################### This email and any files transmitted with it are intende...{{dropped:16}} ______________________________________________ R-help@r-project.org 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.