[R] Extracting numbers from a character variable of different types
ireneruberto at yahoo.it
Sun Mar 18 15:44:09 CET 2012
I have a file which contains a column with age, which is represented in the
two following patterns
1. "007/A" or ''007/a" or ''7 /a" ..... In this case A or a means year and I
would like to extract only the numeric values eg 7 in the above case if this
pattern exits in a line of file.
2. "004/M" or "004/m" where M or m means month ...... for these lines I
would like to first extract the numeric value of Month eg. 4 and then
convert it into a value of years, which would be 0.33 eg 4 divided by 12.
Can anyone help?
View this message in context: http://r.789695.n4.nabble.com/Extracting-numbers-from-a-character-variable-of-different-types-tp4482248p4482248.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help