Wondering if there's an equivalent in r to the SAS put statement for the purpose of creating a new variable by matching an existing variable to a list.
Let's say I wanted to use a list of zip codes and census MSAs...there's a list of all zips and all MSAs
94114 "San Francisco-Oakland, CA"
(and so on, all zips in the US)
I want to match a zip code from an address file and create the MSA field. In SAS I'd run:
Which says "create hsmsaarea by taking zip from working file and matching to a list called '$zipmsa' stored in a library". If zip in address file matchines something in the library file, put the MSA value in the working file.
Is there a similar r function that's not a join or merge? Something I can run as a stand-alone line or ideally in a dplyr chain?