Today I struggled with regex and now this video. This channel is so much underrated. Thank you so much Pat.
@Riffomonas2 жыл бұрын
Wonderful! I’ll have another regex episode on Thursday. Let me know if you have any regex-related questions and we can keep them going 😊
@sven9r2 жыл бұрын
@@Riffomonas You already helped me so much with the matrix problem the other day! Today I nested 350 matrices with the help you provided in under 4 hours. Such a good feeling
@jameswhitaker4357 Жыл бұрын
This is easily the best explanation of regex. Idk how I’ve made it this far without really utilizing them, but some new projects are looking like I’m going to have to use it. You’re a godsend
@tstratton12 жыл бұрын
I think these are my favorite youtube videos of all time. Even if I already know what he's doing.
@Riffomonas2 жыл бұрын
Lol thanks! I’ll do another regular expression video later in the week. Let me know if you have ideas on other things you’d like to see
@dariushghasemi64762 жыл бұрын
@@Riffomonas I'm so enthusiast to dynamic programming, e.g. running multiple linear regression for a bunch of features, or even running mediation analysis! Thanks Patrick :)
@alexw51262 ай бұрын
Great teacher, one of the things I could never get my head around, simlar to the taxonomy levels :D Thank you!
@Riffomonas2 ай бұрын
Wonderful - thanks for watching! 🤓
2 жыл бұрын
Excellent! Regular expressions was always a difficult topic to implement in R. Thanks for the video!
@Riffomonas2 жыл бұрын
My pleasure! There will be another regular expression video out later this week. Let me know if there’s anything else you’d like to learn about regular expressions
@jyotikataria129 Жыл бұрын
@@Riffomonas where is this datatable? Im not able to download it.
@haraldurkarlsson11472 жыл бұрын
Speaking of naming samples. NASA has a great system for naming meteorite samples. For instance the sample "ALH84001". This sample was collected in Antartica in the Allan Hills region during a collecting mission in 1984 (hence the 84). It was the first sample collected (hence the 001). This is a pretty famous meteorite since it is of Martian origin and NASA scientists thought at one point that they had discovered fossil bacteria in it.
@Riffomonas2 жыл бұрын
Very cool! I remember reading the “bacterial fossil” paper in a journal club.
@haraldurkarlsson11472 жыл бұрын
@@Riffomonas I worked on water in Martian meteorites as NRC fellow at NASA for a couple years. The "big" discovery came the year after I left and my sponsor at NASA was one of the authors. Talk about timing...
@mitchdobbs62962 жыл бұрын
Pat this is awesome -- I'm just getting to work on regular expressions and this video was the next puzzle piece for me . You rock!
@Riffomonas2 жыл бұрын
Fantastic! Thanks Mitch. Thursday will have another regex episode with some more advanced concepts. Let me know if there’s anything you’re wondering about and maybe we could keep it going 😊
@mitchdobbs62962 жыл бұрын
@@Riffomonas Heck yeah - can’t wait!
@ErionMaxhari2 жыл бұрын
Excellent job. In fact you can use substr to extract fixed length chars. Especially useful for extracting female or male. It's always the first char
@Riffomonas2 жыл бұрын
Thanks!
@roymccormick53282 жыл бұрын
sooooo super helpful for what I was stuck with today thx😎
@Riffomonas2 жыл бұрын
Wonderful! Glad it was helpful 🤓
@tlange50912 жыл бұрын
This is really, really helpful! Thank you
@Riffomonas2 жыл бұрын
Thanks for watching!
@ROCHAK.TATHYA242 жыл бұрын
This helped alot . Thank you so much
@Riffomonas2 жыл бұрын
Wonderful! I’m so glad to be helpful
@ahmed007Jaber2 жыл бұрын
Great topic. Any tips/ resources to grab a certian text eg xxxx-xxx in string content? Just to grab this pattern and ignore anything else?
@Riffomonas2 жыл бұрын
Wrap the text you want in parentheses and put .* on both sides and then use \\1 as the replacement value
@CoachPegasus2 жыл бұрын
In date column , I need to change ' 04-04-2020' to ' 04/04/2020' , then I need to convert to datetime. i did it with stringr after printing it shows all NAN.
@Riffomonas2 жыл бұрын
With the 04-04-2020 format try using the mdy or dmy functions from lubridate depending on if it’s month-day or day-month
@elcheff2 жыл бұрын
thank you very much
@Riffomonas2 жыл бұрын
My pleasure - thanks for watching!
@jamesleleji6984 Жыл бұрын
How do you find and replace a string in different column names
@spencermartin48462 жыл бұрын
And suddenly it makes sense
@Riffomonas2 жыл бұрын
🤓
@russtin12 жыл бұрын
Regex is great, but you can really pull your hair out trying to figure it out
@Riffomonas2 жыл бұрын
Totally! 😂
@AndreaDalseno2 жыл бұрын
Hi, actually I'm much more comfortable with Python, but I like to improve my skills with R (the other side of the moon) and your videos are simply awesome. This is how I would solve the task in python (where df is a Dataframe and after having imported pandas as pd and re): (pd.DataFrame(df["samples"] .map(lambda y : re.match('(\w)(\d+)(\w)(\d+)',y).group(1,2,4)) .to_list(), columns=['gender', 'sample_n', 'day'], index=df["samples"]) .assign(gender = lambda x : x["gender"].map({'F':'Female', 'M':'Male'}), sample_n = lambda x : x["sample_n"].astype(int), day = lambda x: x["day"].astype(int))) While in R I would do ("translate into") something like this: dist_tbl %>% select("samples")%>% mutate(as_tibble(str_match(matrix(unlist(samples)), "(?\\w)(?\\d*)(?\\w)(?\\d*)")[,c(2,3,5)]))%>% mutate(day = as.integer(day))%>% mutate(sample = as.integer(sample))%>% mutate(gender=ifelse(gender == "F", "Female", "Male")) It should work pretty fine. The good parte of Regular Expressions is that you can solve complex tasks in just one command. PS group matching in python starts from 0 while in R starts from 1 so the numbers in group selection are different. In R I gave a name to each group, while in python it's easier to name the columns since the names, AFAIK, are not returned but only used inside RE.
@Riffomonas2 жыл бұрын
Thanks for watching - I’ll talk about groups in the next episode!