Skip to content

decomposing a single intact vector

3 messages · Jessy, Sarah Goslee, Rui Barradas

#
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: