Alternative to for loops in R with purrr's map, map_dbl, and map_dfr functions (CC043)

  Рет қаралды 9,435

Riffomonas Project

Riffomonas Project

Күн бұрын

Пікірлер: 22
@joseluisloren904
@joseluisloren904 2 жыл бұрын
I discovered this channel looking for answers related to R and RStudio questions I had. I want to thank you for the videos. Great explanations, direct and clear. Thanks!
@Riffomonas
@Riffomonas 2 жыл бұрын
Wonderful - thanks!
@connoross13
@connoross13 2 жыл бұрын
Thanks for the video! Very informative - I'm definitely going to be coming back for more videos. Quick question @15:13 - "I'm only interested in sampling the same number of genomes 100 times... *so threshold = 3*" Why is the threshold 3 here? Is it because we're only sampling 3 genomes?
@Riffomonas
@Riffomonas 2 жыл бұрын
Thanks for watching! It's been a while since I did this, but looking back at the code quickly, I think I was drawing 3 genomes from each species 100 times
@connoross13
@connoross13 2 жыл бұрын
@@Riffomonas Thanks for the clarification! You're a true gentleman for replying.
@bassamabdelnabi3117
@bassamabdelnabi3117 2 жыл бұрын
Great thanks so much. Keep up the good work
@Riffomonas
@Riffomonas 2 жыл бұрын
Thanks! 🤓
@avp300
@avp300 3 жыл бұрын
Great video and explanation!
@Riffomonas
@Riffomonas 3 жыл бұрын
Hi Ankit - Glad you liked it! Thanks for watching and please be sure to spread the word :)
@javierhernando5063
@javierhernando5063 3 жыл бұрын
Great video! What if some of the columns can't be coerced to numeric value? Let say I am performing iterative analysis through a large database in which several variables can't be calculated, but however, I am more interested in running the whole database than picking one by one the variables
@Riffomonas
@Riffomonas 3 жыл бұрын
If your function needs numeric values, then I'd suggest only running the map functions on those columns that are numeric. Alternatively, you could use pivot_longer to put those columns into a single column, then using nest and map with mutate. I have another episode that shows how to do this here: kzbin.info/www/bejne/opnWpWSlmJ6ggbM
@mikedavis979
@mikedavis979 Жыл бұрын
Why does your voice sound funny in this episode? I'm guessing microphone or video processing, or something like that. Or did you have a cold? Ha ha. Anyway, I LOVE your content!!! You have so many videos, surely you can't look through all the comments on all of your videos. That would be a FT job (at least it seems that way). Anyhoo. I took both your online (zoom) MinimalR and mothur workshops, and they have helped so much, as well as your Code Club videos. Thanks again, Pat! Edit on comment: seems like your voice sounded different more in the first 5 minutes of the video. Or maybe I have recently ingested too much EtOH, as an ingredient in double IPAs. Ha! Anyway, your videos are so helpful, they are a positive contribution to reproducible science, insights into Microbiology, Microbiomes, and statistical analyses in general. Also a boon to using R for significant biological research. I better quit before the lauding seems more like exaggerated adulation.
@doming258
@doming258 2 жыл бұрын
Hi can you do a episode to compare two graphs for the purpose of validation?
@Riffomonas
@Riffomonas 2 жыл бұрын
Hmmm maybe but I’m not sure what you mean. Do you have an example?
@doming258
@doming258 2 жыл бұрын
@@Riffomonas if I have two similar graphs done by two independent programmers, how do I compare them programmatically to see if there are differences? For example, two scatter plots
@russtin1
@russtin1 3 жыл бұрын
Happy birthday
@Riffomonas
@Riffomonas 3 жыл бұрын
HAH! Thanks 😊
@terraflops
@terraflops 3 жыл бұрын
with so many YT channels asking me to "SMASH THE LIKE BUTTON" it has removed my ability to do so on this video.
@Riffomonas
@Riffomonas 3 жыл бұрын
HA! Well, just be sure to keep coming back for more :)
@haraldurkarlsson1147
@haraldurkarlsson1147 2 жыл бұрын
Pat, This might sound like an out of place comment but have you heard of something called a "super assignment operator" designed by
@Riffomonas
@Riffomonas 2 жыл бұрын
Yeah it allows you to modify a variable so that it remains changed outside of a function even if you don’t return that variable. This is generally seen as a very bad idea
@haraldurkarlsson1147
@haraldurkarlsson1147 2 жыл бұрын
Aha! Basically defining a local variable as global. I know this is considered bad form in python (probably all languages) in general.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 35 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 21 МЛН
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 117 МЛН
Don't write loops in R
22:01
Bruno Rodrigues
Рет қаралды 4,5 М.
Loops using R programming
13:37
R Programming 101
Рет қаралды 16 М.
TidyTuesday: A Brief Overview of Functional Programming with Purrr
44:04
The purrr package map functions in the Tidyverse; Learn R Video 11
16:31
DesignCodeDebugRepeat
Рет қаралды 776
Indexing and looping over lists in R, a tutorial (CC174)
19:59
Riffomonas Project
Рет қаралды 5 М.
Don't write loops in R (part 2) with purrr::reduce
11:28
Bruno Rodrigues
Рет қаралды 6 М.
For Loops in R
11:34
Richard Webster
Рет қаралды 209 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН