Hi, I am trying to extract some numbers from a text string. The problem is that the delimiting symbols are identical so that I do not know how to tell "sub" between which of them to extract. The string looks like this 12/01/03/08 The extracted variables should look like: x1=12 x2=01 x3=03 x4=08 If anybody could help or point me to useful help, I would be greatful. Cheers, Daniel ------------------------- cuncta stricte discussurus
Henrique Dallazuanna
2008-Nov-20 10:17 UTC
[R] sub / gsub - extracting between identical symbols
Try this: unlist(strsplit("12/01/03/08", "/")) On Thu, Nov 20, 2008 at 6:08 AM, Daniel Malter <daniel@umd.edu> wrote:> Hi, I am trying to extract some numbers from a text string. The problem is > that the delimiting symbols are identical so that I do not know how to tell > "sub" between which of them to extract. > > The string looks like this > > 12/01/03/08 > > The extracted variables should look like: > > x1=12 > x2=01 > x3=03 > x4=08 > > If anybody could help or point me to useful help, I would be greatful. > > Cheers, > Daniel > > ------------------------- > cuncta stricte discussurus > > ______________________________________________ > R-help@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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]