"unsparse" a vector
Suppose I have a vector of strings:
c("A1B2","A3C4","B5","C6A7B8")
[1] "A1B2" "A3C4" "B5" "C6A7B8"
where each string is a sequence of <column><value> pairs
(fixed width, in this example both value and name are 1 character, in
reality the column name is 6 chars and value is 2 digits).
I need to convert it to a data frame:
data.frame(A=c(1,3,0,7),B=c(2,0,5,8),C=c(0,4,0,6))
A B C
1 1 2 0
2 3 0 4
3 0 5 0
4 7 8 6
how do I do that?
thanks.
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000 http://mideasttruth.com http://jihadwatch.org http://pmw.org.il http://openvotingconsortium.org http://iris.org.il http://memri.org What's the difference between Apathy & Ignorance? -I don't know and don't care!