An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120628/f96edd62/attachment.pl>
decomposing a single intact vector
3 messages · Jessy, Sarah Goslee, Rui Barradas
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120628/fbc6acb2/attachment.pl>
Hello,
Try
x <- "(O, O, O, H, L, O, O, O, O)"
strsplit(gsub("\\(|\\)|[[:blank:]]", "", x), ",")
Note that the result is a list, not a vector. You can then use `[[` or
unlist().
Hope this helps,
Rui Barradas
Em 28-06-2012 11:42, Jessy escreveu:
Dear all, I have a vector of length 1 but within this vector there are 9 elements
vectorNOcorrection
[1] "(O, O, O, H, L, O, O, O, O)" can someone help me with how I can have it as with 9 element separated such that it will have length 9 as "O", "O"," O", "H","L", "O", "O", "O", "O" Kind regards, Jessy [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list 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.