Basically, I have a dataset where one column is a series of three digit codes. I only really need the first digit of those codes though for my analysis. For this reason, I want to create a new column containing only the first digit of that column, so I can do some dummy variables based on that. For example, if A is the original column, I want to create column B, as below:
A B
123 1
999 9
222 2
Anyone got an idea how to do this? I can't find anything online. Alternatively, if its possible to base dummy variables based on only the first digit of A, without creating B, that would also work.