Skip to content
Prev 299424 / 398503 Next

Splitting a character vector.

The space is for a different reason, strsplit doesn't put the split 
pattern in the result, so if a space is included it will be 
automatically deleted. For instance in "XXY (mat harry)" without the 
space it would become "XXY " and "mat harry)" but we want "XXY" so 
include the space in the pattern.

Another example, this one artificial:

"123AB456" ---> "123" and "456"

strsplit("123AB456", "B") ---> "123A" and "456"

So include the "A" in the pattern. It's _exactly_ the same thing.

Rui Barradas

Em 07-07-2012 23:21, John Kane escreveu: