Remove non-Arabic words in R [on hold]
I am trying to remove non Arabic words in r
and i tried this code but it is removed everything
> L<-"you المجدo to yes"
> gsub("[^\p{InArabic}.,]+","",L)
[1] ""
r
New contributor
put on hold as off-topic by karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen Jan 2 at 6:02
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I am trying to remove non Arabic words in r
and i tried this code but it is removed everything
> L<-"you المجدo to yes"
> gsub("[^\p{InArabic}.,]+","",L)
[1] ""
r
New contributor
put on hold as off-topic by karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen Jan 2 at 6:02
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen
If this question can be reworded to fit the rules in the help center, please edit the question.
You likely need to addperl = TRUE
in order for R to compile the regex in PCRE mode. Also I'm not sure that{InArabic}
is supported - though{Arabic}
does seem to be ex.gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
– steeldriver
Dec 30 '18 at 22:40
yes it worked thank you
– Fatima Albusayyis
Dec 31 '18 at 7:04
add a comment |
I am trying to remove non Arabic words in r
and i tried this code but it is removed everything
> L<-"you المجدo to yes"
> gsub("[^\p{InArabic}.,]+","",L)
[1] ""
r
New contributor
I am trying to remove non Arabic words in r
and i tried this code but it is removed everything
> L<-"you المجدo to yes"
> gsub("[^\p{InArabic}.,]+","",L)
[1] ""
r
r
New contributor
New contributor
New contributor
asked Dec 30 '18 at 8:23
Fatima Albusayyis
61
61
New contributor
New contributor
put on hold as off-topic by karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen Jan 2 at 6:02
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen Jan 2 at 6:02
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – karel, N0rbert, Eric Carvalho, Kevin Bowen, George Udosen
If this question can be reworded to fit the rules in the help center, please edit the question.
You likely need to addperl = TRUE
in order for R to compile the regex in PCRE mode. Also I'm not sure that{InArabic}
is supported - though{Arabic}
does seem to be ex.gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
– steeldriver
Dec 30 '18 at 22:40
yes it worked thank you
– Fatima Albusayyis
Dec 31 '18 at 7:04
add a comment |
You likely need to addperl = TRUE
in order for R to compile the regex in PCRE mode. Also I'm not sure that{InArabic}
is supported - though{Arabic}
does seem to be ex.gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
– steeldriver
Dec 30 '18 at 22:40
yes it worked thank you
– Fatima Albusayyis
Dec 31 '18 at 7:04
You likely need to add
perl = TRUE
in order for R to compile the regex in PCRE mode. Also I'm not sure that {InArabic}
is supported - though {Arabic}
does seem to be ex. gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
– steeldriver
Dec 30 '18 at 22:40
You likely need to add
perl = TRUE
in order for R to compile the regex in PCRE mode. Also I'm not sure that {InArabic}
is supported - though {Arabic}
does seem to be ex. gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
– steeldriver
Dec 30 '18 at 22:40
yes it worked thank you
– Fatima Albusayyis
Dec 31 '18 at 7:04
yes it worked thank you
– Fatima Albusayyis
Dec 31 '18 at 7:04
add a comment |
1 Answer
1
active
oldest
votes
You need to add perl = TRUE
in order for R to compile the regex in PCRE mode.
Also I'm not sure that {InArabic}
is a supported character class - though {Arabic}
does seem to be, at least in my version of R (R version 3.4.4 (2018-03-15) -- "Someone to Lean On"):
> L<-"you المجدo to yes"
>
> gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
[1] "المجد"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to add perl = TRUE
in order for R to compile the regex in PCRE mode.
Also I'm not sure that {InArabic}
is a supported character class - though {Arabic}
does seem to be, at least in my version of R (R version 3.4.4 (2018-03-15) -- "Someone to Lean On"):
> L<-"you المجدo to yes"
>
> gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
[1] "المجد"
add a comment |
You need to add perl = TRUE
in order for R to compile the regex in PCRE mode.
Also I'm not sure that {InArabic}
is a supported character class - though {Arabic}
does seem to be, at least in my version of R (R version 3.4.4 (2018-03-15) -- "Someone to Lean On"):
> L<-"you المجدo to yes"
>
> gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
[1] "المجد"
add a comment |
You need to add perl = TRUE
in order for R to compile the regex in PCRE mode.
Also I'm not sure that {InArabic}
is a supported character class - though {Arabic}
does seem to be, at least in my version of R (R version 3.4.4 (2018-03-15) -- "Someone to Lean On"):
> L<-"you المجدo to yes"
>
> gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
[1] "المجد"
You need to add perl = TRUE
in order for R to compile the regex in PCRE mode.
Also I'm not sure that {InArabic}
is a supported character class - though {Arabic}
does seem to be, at least in my version of R (R version 3.4.4 (2018-03-15) -- "Someone to Lean On"):
> L<-"you المجدo to yes"
>
> gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
[1] "المجد"
answered Jan 1 at 2:57
steeldriver
65.9k11105178
65.9k11105178
add a comment |
add a comment |
You likely need to add
perl = TRUE
in order for R to compile the regex in PCRE mode. Also I'm not sure that{InArabic}
is supported - though{Arabic}
does seem to be ex.gsub("[^\p{Arabic}.,]+", "", L, perl = TRUE)
– steeldriver
Dec 30 '18 at 22:40
yes it worked thank you
– Fatima Albusayyis
Dec 31 '18 at 7:04