[R] strsplit with invalid regular expression

arun smartpink111 at yahoo.com
Thu Nov 8 14:48:22 CET 2012


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 <bwarule at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Thursday, November 8, 2012 6:39 AM
Subject: [R] strsplit with   invalid regular expression

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 with "(" it’s working fine but when i want use
"sin(" this is not working.
I understand that, I am missing something can anybody please point me.
Thanks for your help.

Thanks,
Bharat



-----
Bharat Warule 
Pune
--
View this message in context: http://r.789695.n4.nabble.com/strsplit-with-invalid-regular-expression-tp4648857.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.





More information about the R-help mailing list