You need another \\
> strsplit("a||bc","\\|\\|")
[[1]]
[1] "a" "bc"
>
On Thu, Mar 22, 2012 at 3:23 AM, jing tang <jing.tang at fimm.fi>
wrote:> Hi,
>
> I tried to use strsplit for separating a string with || like
> strsplit(string,"\\||") but it returned each single character was
separated.
>
> For example:
>
> strsplit("a||bc","\\||")
>
> [[1]]
>
> [1] "a" "" ?"" ?"b" "c"
>
>
>
> where I want the result to be "a" and "bc".
>
>
>
>
>
> Any ideas?
>
> Thanks!
>
>
>
> Best,
>
> Jing
>
>
>
>
>
>
> ? ? ? ?[[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.
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.