Splitting columns in R with the separate() command

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024
  • The separate() command lets you break up columns that includes multiple variables. Yay for tidy data!
    If this vid helps you, please help me a tiny bit by mashing that 'like' button. For more #rstats joy, crush that 'subscribe' button!

ความคิดเห็น • 24

  • @EquitableEquations
    @EquitableEquations  ปีที่แล้ว

    You can find materials supporting this vid (and others) at github.com/equitable-equations/youtube.

  • @ndowidar
    @ndowidar 10 หลายเดือนก่อน

    Thank you so much for teaching this lesson!

  • @CanDoSo_org
    @CanDoSo_org ปีที่แล้ว

    Cool, very useful command! Thank you so much!

  • @andresmeneses6601
    @andresmeneses6601 2 ปีที่แล้ว

    What an amazing channel. Thank you for your help!

  • @haraldurkarlsson1147
    @haraldurkarlsson1147 6 หลายเดือนก่อน

    separate has been replaced with separate_wider_(delim, position or regex). It is a great function.

  • @Gisele633
    @Gisele633 ปีที่แล้ว

    Wonderfully thaks!!!

  • @mugomuiruri2313
    @mugomuiruri2313 ปีที่แล้ว

    Wonderful

  • @oscarrosalescorzo
    @oscarrosalescorzo 2 ปีที่แล้ว

    Thanks for the video

  • @romanvasiura6705
    @romanvasiura6705 ปีที่แล้ว

    Thank you!

  • @Plantss
    @Plantss 2 ปีที่แล้ว +1

    Thank you for a wonderful tutorial! I'm working with large dataset, and I can see the results I'm looking for in the console by doing head() but its not applying to my actual dataset when i do View(). Im not sure what im doing wrong here. Any advice?

    • @EquitableEquations
      @EquitableEquations  2 ปีที่แล้ว +1

      Hmm, you should see similar things with head and View, assuming you pass them each the same data set. My guess is that your inputs aren't exactly the same. Good luck!

  • @mohammadzarifwahidy9020
    @mohammadzarifwahidy9020 2 ปีที่แล้ว +1

    what if a column contains a vector, instead of Johny Smith you have c(Johny, Smith) and instead of Mary Smith you have c(Mary, Smith). How do you separate them? thanks

    • @EquitableEquations
      @EquitableEquations  2 ปีที่แล้ว

      Hi! The hoist() command is probably what you're looking for.

  • @MorrisMcK
    @MorrisMcK 2 ปีที่แล้ว +1

    Professor. It is a great content. I have a large dataset of tick level data. So, each day i have thousands of transactions. Is it possible to split daily transactions data into three buckets- namely low, medium, and large transactions. Say there are 30k transactions. I want first 10k as low, the middle 10k as medium, and the rest as large? Thank You.

    • @EquitableEquations
      @EquitableEquations  2 ปีที่แล้ว

      Hi! Either cut() or one of the slice_*() functions should do the job. I have a vid on the latter: th-cam.com/video/7bqtmMfDg-4/w-d-xo.html

  • @tmitra001
    @tmitra001 2 หลายเดือนก่อน

    hi it is not saving in smits data after you split! right?

  • @toluojutiku9585
    @toluojutiku9585 ปีที่แล้ว

    Hello, Thank you for the video, this was very explanatory. But what do we do if we want to split the observations in Multiple columns in our dataset into multiple columns, what do we do? I tried the separate function, but this didn't work

    • @EquitableEquations
      @EquitableEquations  ปีที่แล้ว

      Hi! The separate() command specifically targets a single column, probably because a lot could go wrong if you were to split multiple columns at once. While you could iterate the process, I'd be nervous about doing so.

  • @jamesleleji6984
    @jamesleleji6984 ปีที่แล้ว +1

    how do you separate the values of a column where no delimiter is given?

    • @EquitableEquations
      @EquitableEquations  ปีที่แล้ว +1

      There has to be some sort of delimiter in order for this task to make sense, right? Either in the data or user-specified.

    • @jamesleleji6984
      @jamesleleji6984 ปีที่แล้ว

      @@EquitableEquations Thanks, I've figured it out. I used, sep = 1 to split the values of a column sexage into 2 new columns sex and age..

  • @어쩔티비-k3w
    @어쩔티비-k3w 2 ปีที่แล้ว

    I have some question .
    This is my code and I think I did same as you, but it doesnt work.
    separate(Graduation_1,
    col = date,
    into = c("year", "month", "day"))

    Error code :
    Must extract column with a single valid subscript.
    x Subscript `var` has the wrong type `function`.
    i It must be numeric or character.
    Run `rlang::last_error()` to see where the error occurred.

    • @EquitableEquations
      @EquitableEquations  2 ปีที่แล้ว

      Hi! For specific questions like this, I recommend the R4DS learning community. www.rfordatasci.com/