Error in IF condition

Hi all,

I was trying to write IF condition in my code
If(nrow(x) == nrow(y) == nrow(z)){

Print (x)
Print(y)
Print (z)
}

I was getting the error
Error: unexpected == in if
Error: unexpected } in “}”

Please help me

Possibly uppercase "I" in "if" where it should be lowercase.

on its own nrow(x) == nrow(y) == nrow(z) is invalid R syntax, I assume your intent is to evaluate (nrow(x)==nrow(y)) & (nrow(y)==nrow(z)) which I write here in a valid form.

2 Likes

Thank you. Solved now

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.