Hi, How do I extract the first number after '*' in a vector?
The vector is given below > dput(out[1:10]) c(" 1 X[0,SMITH] * 0 0 1 ", " 2 X[0,JOHNSON] * 0 0 1 ", " 3 X[0,WILLIAMS]", " * 1 0 1 ", " 4 X[0,JONES] * 0 0 1 ", " 5 X[0,BROWN] * 0 0 1 ", " 6 X[0,DAVIS] * 0 0 1 ", " 7 X[0,MILLER] * 0 0 1 ", " 8 X[0,WILSON] * 0 0 1 ", " 9 X[0,MOORE] * 0 0 1 " ) I want a vector with the first number after the asterisk. So the output would give me, a vector (0,0,1,0,0,0,0,0,0,0) How can I do it in R? Best, Abhinaba [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.