What does this code means in R? full$Title <- gsub('(.*, )|(\..*)', '', full$Name) [closed]










-3















```r, message=FALSE, warning=FALSE
# Grab title from passenger names
full$Title <- gsub('(.*, )|(\..*)', '', full$Name)

# Show title counts by sex
table(full$Sex, full$Title)









share|improve this question















closed as unclear what you're asking by Roland, Rui Barradas, Makyen, MLavoie, camille Nov 16 '18 at 0:00


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • See ?regex.

    – Rui Barradas
    Nov 15 '18 at 7:13















-3















```r, message=FALSE, warning=FALSE
# Grab title from passenger names
full$Title <- gsub('(.*, )|(\..*)', '', full$Name)

# Show title counts by sex
table(full$Sex, full$Title)









share|improve this question















closed as unclear what you're asking by Roland, Rui Barradas, Makyen, MLavoie, camille Nov 16 '18 at 0:00


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


















  • See ?regex.

    – Rui Barradas
    Nov 15 '18 at 7:13













-3












-3








-3








```r, message=FALSE, warning=FALSE
# Grab title from passenger names
full$Title <- gsub('(.*, )|(\..*)', '', full$Name)

# Show title counts by sex
table(full$Sex, full$Title)









share|improve this question
















```r, message=FALSE, warning=FALSE
# Grab title from passenger names
full$Title <- gsub('(.*, )|(\..*)', '', full$Name)

# Show title counts by sex
table(full$Sex, full$Title)






r feature-engineering






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 6:58









Roland

101k6112189




101k6112189










asked Nov 15 '18 at 6:20









siddharth inglesiddharth ingle

1




1




closed as unclear what you're asking by Roland, Rui Barradas, Makyen, MLavoie, camille Nov 16 '18 at 0:00


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by Roland, Rui Barradas, Makyen, MLavoie, camille Nov 16 '18 at 0:00


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • See ?regex.

    – Rui Barradas
    Nov 15 '18 at 7:13

















  • See ?regex.

    – Rui Barradas
    Nov 15 '18 at 7:13
















See ?regex.

– Rui Barradas
Nov 15 '18 at 7:13





See ?regex.

– Rui Barradas
Nov 15 '18 at 7:13












1 Answer
1






active

oldest

votes


















1














(.*, ) -> means any text before and including a comma and space. It will match "test, " in "test, dummy"



(\..*) -> means anything after and including a dot. It will match ".dummy" in "test.dummy"



(.*, )|(\..*) -> means matching first OR second pattern



So it will transform something like "test, dummy.something" into "dummy" by replacing matched text with ""






share|improve this answer































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    (.*, ) -> means any text before and including a comma and space. It will match "test, " in "test, dummy"



    (\..*) -> means anything after and including a dot. It will match ".dummy" in "test.dummy"



    (.*, )|(\..*) -> means matching first OR second pattern



    So it will transform something like "test, dummy.something" into "dummy" by replacing matched text with ""






    share|improve this answer





























      1














      (.*, ) -> means any text before and including a comma and space. It will match "test, " in "test, dummy"



      (\..*) -> means anything after and including a dot. It will match ".dummy" in "test.dummy"



      (.*, )|(\..*) -> means matching first OR second pattern



      So it will transform something like "test, dummy.something" into "dummy" by replacing matched text with ""






      share|improve this answer



























        1












        1








        1







        (.*, ) -> means any text before and including a comma and space. It will match "test, " in "test, dummy"



        (\..*) -> means anything after and including a dot. It will match ".dummy" in "test.dummy"



        (.*, )|(\..*) -> means matching first OR second pattern



        So it will transform something like "test, dummy.something" into "dummy" by replacing matched text with ""






        share|improve this answer















        (.*, ) -> means any text before and including a comma and space. It will match "test, " in "test, dummy"



        (\..*) -> means anything after and including a dot. It will match ".dummy" in "test.dummy"



        (.*, )|(\..*) -> means matching first OR second pattern



        So it will transform something like "test, dummy.something" into "dummy" by replacing matched text with ""







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 15 '18 at 12:17

























        answered Nov 15 '18 at 12:12









        Billy34Billy34

        22615




        22615















            這個網誌中的熱門文章

            Barbados

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3