[R] string split problem

Jun Shen jun.shen.ut at gmail.com
Fri Oct 23 21:17:08 CEST 2015


Dear list,

Say I have a vector that has two different types of string

test <- c('aaa.bb.cc','aaa.dd')

I want to extract the first part of the string (aaa) as a name and save the
rest of the string as another name.

I was thinking something like

sub('(.*)\\.(.*)','\\1',test) but doesn't give me what I want.


Appreciate any comments. Thanks.

Jun

	[[alternative HTML version deleted]]



More information about the R-help mailing list