I need some of the variables of my dataframe to have a given number of digits. In this case, I need "st" variable to have 2 digits and "county" variable to have 3 digits.
Let's say I have this dataframe:
state(Alabama, Alabama, Alabama, Alabama, Alabama, Alabama)
st(3,5,7,9,11,13)
county(7, 33, 15, 17, 111, 189)
state_county <- data.frame(state, st, county)
And I want to get this:
tate(Alabama, Alabama, Alabama, Alabama, Alabama, Alabama)
st(03,05,07,09,11,13)
county(007, 033, 015, 017, 111, 189)
state_county1 <- data.frame(state, st, county)
Thanks!