I have 2 dataframes with numeric codes that represent various jobs.
One df (df_a
) has codes from census the other (df_b
) has codes that represent essential jobs.
I need to create a new column in df_a with where jobs are listed as essential or non-essential based on codes in df_b
.
The issue is that some job codes in df_a
have character M = multiple integers in df_b
(e.g. 123M5 in df_a
= 12335, 12345, 12355... in df_b
). I am trying to accomplish this by setting M='\\d'
in df_a but not succeeding... any thoughts on a better way to approach this?
Thanks!
R function to substitute a character with any integer
60 Views Asked by learningR At
1
This might be what you need: