Creating an advanced regular expression in R with str_replace and separate (CC184)

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 28

  • @russtin1
    @russtin1 2 роки тому +3

    I was aware of the () but didn’t quite grok it. This is the best explanation I have seen

    • @Riffomonas
      @Riffomonas  2 роки тому

      Wonderful! I forgot to point out that this is also why if you want to match a ( you need to use \\(

  • @mariliaamaralmarcondes6943
    @mariliaamaralmarcondes6943 4 місяці тому

    I am from Brazil and your explanation is so good that I can understand all your class. Thank you very much.

    • @Riffomonas
      @Riffomonas  4 місяці тому

      Wonderful - my pleasure!

  • @leonelemiliolereboursnadal6966
    @leonelemiliolereboursnadal6966 2 роки тому +2

    Thanks again for make R learning easy!

    • @Riffomonas
      @Riffomonas  2 роки тому

      My pleasure! Glad you enjoyed it 😊

  •  2 роки тому +2

    This is really useful! Thanks!

  • @mitchdobbs6296
    @mitchdobbs6296 2 роки тому +1

    Awesome follow up, Pat! Loved the inclusion of the parentheses and taking it apart piece by piece, and also the inclusion of the separate function. On to lookaheads/behinds!

    • @Riffomonas
      @Riffomonas  2 роки тому +2

      Even I have to use the cheat sheet to figure that stuff out 😂

  • @MrFlick
    @MrFlick 2 роки тому +2

    The `tidyr::extract()` function would combine the `str_replace` and `separate()` commands for you. For example: dist_tbl %>%
    tidyr::extract(samples, into=c("sex", "animal", "day"), regex="^(([FM])\\d+)D(\\d+)$", remove=FALSE, convert=TRUE). That way you don't have to bother with the intermediate string concatenation.

    • @sven9r
      @sven9r 2 роки тому

      Didn't know that yet. Always combine str_replace and unite() or separate()! ty

    • @Riffomonas
      @Riffomonas  2 роки тому

      Thanks- so many options!

  • @AndreaDalseno
    @AndreaDalseno 2 роки тому +1

    Awesome, I always learn a lot from your videos

  • @aliabookazempour6782
    @aliabookazempour6782 2 роки тому +1

    An amazing instructive video. Thank you for sharing it🙌.

    • @Riffomonas
      @Riffomonas  2 роки тому

      Wonderful- glad you enjoyed it!

  • @joseavila7825
    @joseavila7825 2 роки тому +1

    Excelent video!

  • @ahmed007Jaber
    @ahmed007Jaber 2 роки тому +1

    Love this Pat! keep it up!
    would love to see more of such content. I actually do such things most of the time. For a long time been doing this in excel and now trying to shift that in R. My challenge is that I use it in Arabic text.

    • @Riffomonas
      @Riffomonas  2 роки тому

      Hi Ahmad - I know I’d have a very hard time doing anything in Arabic text 😂

    • @ahmed007Jaber
      @ahmed007Jaber 2 роки тому

      @@Riffomonas lool; I am leveraging R even in Arabic now, though, it just takes some time
      what is the best way to reach you out?
      I have been using pivot tables for a bit and they are time saving at times.
      I have a database of projects their budgets and costs. I know that I can create custom subtotals and custom calculated columns, but was wondering if i could add a line underneath a subtotal to do a calculation e.g. i have one budget for the whole project but several categories of expenses. So I need to show the breakdown of expenses and at the end sum of it and then a new line showing the value of surplus or deficit.
      Another thing I just noticed, if I added it to a data model to create a measure and check the variance, I am not able to choose custom subtotals
      I would prefer to do it without VBA, but if it is a must, why not
      Sth like the one on the far right
      in a nut shell; i need to do a report on projects each will have its own budget and obviously different types of expenses which will be listed. after this there will be one line showing deficit or surplus for that project.
      I will need to find a way to do this and then export it to word.
      how would u approach it?

  • @robertcrump1665
    @robertcrump1665 Рік тому

    @11:47 btw love the series

  • @dasrotrad
    @dasrotrad 2 роки тому +1

    Thanks Pat. Regex is so difficult.

    • @Riffomonas
      @Riffomonas  2 роки тому

      My pleasure- it’s a different way of thinking but so so powerful once you get the hang of it

  • @10maxnyc
    @10maxnyc Рік тому

    What’s the shortcut key to make the parentheses? I see him highlight and then press some key to make parentheses.

  • @Dr.Munshi-Naser
    @Dr.Munshi-Naser 2 роки тому +1

    Hi, Thanks a lot. I need your help. I teach econometrics in my University and I really need something econometrics plugins to R commander or any GUI like radiant package which can help students learn econometrics very easily. Like STATA, drag and drop option for time series and panel data. Just like the BI tools. Can you please help me? I will be ever grateful to you. I subscribe to your community and I really need your advice...can you help me.....Thanks in advance

    • @Riffomonas
      @Riffomonas  2 роки тому +1

      Sorry I only teach what I use. I prefer R because it is so much more reproducible than gui based tools