I'm relatively new to R, taken a few classes, etc. However, I'm trying to do something that has really stumped me and I just can't seem to find an answer to despite it being a task which seems trivial and likely has been done countless times. So I have a dataset and in that dataset is a field "Name" that contains, go figure, names. However, that field includes the persons title in their name, e.g. Mr., Mrs., Miss, etc. What I'm looking to do is create a new column "Title" (I've made this column already) and have that column contain the titles in a numeric form such as Mr. = 1, Mrs. = 2, Miss = 3, etc. The solutions I've found propose new subsets of data but I don't really want that, I want to add a new column in the current dataset with this information. I realize this probably sounds like a trivial task to those experienced with R but it's driving me bonkers. Thank you for any help that can be provided.
Expected output:
Name Title
Jones, Mr. Frank 1
Jennings, Mrs. Joan 2
Hinker, Miss. Lisa 3
Brant, Mrs. Jane 2
Allin, Mr. Hank 1
Minks, Mr. Jeff 1
Naps, Mr. Tim 1