merge - Have nomatch return value as-is using match function in R -
merge - Have nomatch return value as-is using match function in R - i have much larger existing dataframe. smaller illustration replace of variables (replace state (df1)) newstate (df2) according column "first." issue values returned na since of names matched in new dataframe (df2). existing dataframe: state = c("ca","wa","or","az") first = c("jim","mick","paul","ron") df1 <- data.frame(first, state) first state 1 jim ca 2 mick wa 3 paul or 4 ron az new dataframe match existing dataframe state = c("ca","wa") newstate = c("tx", "la") first =c("jim","mick") df2 <- data.frame(first, state, newstate) first state newstate 1 jim ca tx 2 mick wa la tried utilize match returns na "state" matching "first" variable df2 not found in ori