In R, the source code representation of a special character uses the \ as an
escape character to begin a special character sequence. For example, "\n" is a
single newline character.
Because backslash has this special meaning, to represent a single backslash
character one must escape it: "\\" lo
HI,
cond<-"andsin(log_angle_1_4)"
diff_operator<-"sin\\("
strsplit(cond,diff_operator)
#[[1]]
#[1] "and" "log_angle_1_4)"
A.K.
- Original Message -
From: Bharat Warule
To: r-help@r-project.org
Cc:
Sent: Thursday, Novem
> strsplit(")asdasdsin(abcd)", "sin\\(")
[[1]]
[1] ")asdasd" "abcd)"
>
On Thu, Nov 8, 2012 at 12:39 PM, Bharat Warule wrote:
> Hi all,
>
> > diff_operator <- "\\("
> > strsplit(cond, diff_operator)
> [[1]]
> [1] "andsin" "log_angle_1_4)"
>
> > diff_operator <- "\\sin("
> > strsplit(co
Hi all,
> diff_operator <- "\\("
> strsplit(cond, diff_operator)
[[1]]
[1] "andsin" "log_angle_1_4)"
> diff_operator <- "\\sin("
> strsplit(cond, diff_operator)
Error in strsplit(cond, diff_operator) :
invalid regular expression '\sin(', reason 'Missing ')''
When I am going to split w
4 matches
Mail list logo