I have a data frame containing multiple 4 digit codes. Based on the value of the third digit I would like to manipulate the data frame in the following way:
- If 3rd digit != "0" do nothing
- If 3rd digit == "0" then eliminate this element and replace it with the following one xx{10-99}. Where xx are the initial fist two digits of the element and {10-99} indicates {xx10,xx11,xx12,...,xx99} should be added to the data frame.
Any ideas how this could be implemented maybe with dplyr? Thanks in advance!
e.g.
df <- data.frame("id"= c("1111","1231","1000","2222","2900")
df
and i would like to convert df to the following df
{"1111","1231","1010","1011",...,"1099","2222","2910","2911",..."2999"}