r - replace decimal point from strings in entire column -


I am working with a column on a data set such that such a number:

 To run the code, icod9code 285.21 r  comorbidities , I need to convert them to 5 digit numbers without decimal digits. 

Why should they look like this:

icd9code 28521 59390 28521 v0481

Which functions can I use? Specifically, how can I get it to show 0 at the end of the number if it has only 4 digits, apart from this, how can I move with 'v'?

Here is a vectorated solution:

  x < -c ("285.21", "593.9", "285.21", "v04.81") substrate (gsub ("\\.", "", Paste 0 (x, "00000"), 1, 5) # [ 1] "28521" "59390" "28521" "v0481"  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -