R ifelse condition %in% three data frames

I am trying to populate a data frame (x) with variables from two other data frames y and z based on the key variable SSL, if matches are found populate X data frame with land area from y and z.

I used the below code but it seems the match is not successful, it runs but the match is wrong! I am not sure what is wrong.

Rcode:

x$LANDAREA <- ifelse(x$SSL %in% y$SSL,y$LANDAREA,ifelse(x$SSL %in% z$SSL,z$LANDAREA,-999))

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

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.