Remove non-Arabic words in R [on hold]












-1














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] ""









share|improve this question







New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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
















-1














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] ""









share|improve this question







New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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














-1












-1








-1







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] ""









share|improve this question







New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question







New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Dec 30 '18 at 8:23









Fatima Albusayyis

61




61




New contributor




Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Fatima Albusayyis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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


















  • 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
















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










1 Answer
1






active

oldest

votes


















2














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] "المجد"





share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    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] "المجد"





    share|improve this answer


























      2














      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] "المجد"





      share|improve this answer
























        2












        2








        2






        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] "المجد"





        share|improve this answer












        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] "المجد"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 1 at 2:57









        steeldriver

        65.9k11105178




        65.9k11105178















            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?