[R] separate a variable in several variables

CE.KA ce.kaya75 at yahoo.fr
Wed Nov 12 22:09:32 CET 2008


Hello R users,
Imagine the data frame DATA with the variable x which is composed by numeric
and alpha caracters.

> DATA
     x
1   12F
2   13 AD
3   356PO
4   1D
5   GRT
6   PO52
7   LN4Z

Is there a way to separarate x in 2 variables:
y: only numeric caracters
z: only alpha caracters
For exemple:
     x           y          z
1   12F        12         F
2   13 AD     13         AD
3   356PO     356      PO
4   1D          1         D
5   GRT        0         GRT
6   PO52      52      PO
7   LN4Z      4         LNZ

Kind regards
-- 
View this message in context: http://www.nabble.com/separate-a-variable-in-several-variables-tp20469491p20469491.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list