I have a `data.frame` `X`, with a column `A` filled with `chr`, most of them are of `nchar` = 5, but some are of `nchar`=4. I want to put a `0` in front of those.

I would do it with the following kind-of-pseudo-code :

```
foreach( element_of_X$A as a ){  # this line is pseudo-code for Idk how to do it in R
    if(nchar(a) < 5){            # I think these lines are valid
        paste0(0,a)              # I think these lines are valid
    }
}

```

(Obviously I come from PHP). How can I do that in clean R code ? (That, or a more efficient solution)

Thanks