I am creating a new column. I want it to be based on two other columns that both hold logicals - Acct and Con. The result column should be the "OR" between them, so I tried:
lead.data$AcctOrCon <- lead.data$Acct || lead.data$Con
This made all the columns TRUE. I am assuming it's because it's checking if either column has TRUE at all in the whole column. I guess that makes sense.
So, I wrote this loop:
for(row in 1:nrow(lead.data))
{
lead.data$AcctOrCon[row] <- lead.data$Acct[row] || lead.data$Con[row]
}
This works fine, but I know there has to be a better way. Also, I've read that R isn't very fond of loops - this one's only about 50,000 lines, but I don't want to get bad habits when I'm dealing with a million. I've searched around and it seems like the first answer SHOULD work...