For loops in R: a tutorial on how to simplify your code without compromising performance (CC173)

preview_player
Показать описание
For loops get a bad rap in R. In this tutorial, I'll share they syntax for writing a for loop and how we can use a for loop to simplify our code without compromising the performance of our code. This is part of a series of videos demonstrating how to functions from base R to make these data compatible with tools from the tidyverse

#matrix #baseR #R #Rstats

You can also find complete tutorials for learning R with the tidyverse using...

0:00 Creating DRY code with for loops
2:01 Syntax to create a for loop
5:06 Finding patterns in repeated code
10:17 Writing for loop to create distance matrix
11:20 Demonstrating the value of DRY code
13:30 Overcoming concerns about for loops
Рекомендации по теме
Комментарии
Автор

Thanks Pat. You're doing a great service for experienced and new coders alike.

marc_CFA_applied_econ
Автор

Thanks Pat, I have enjoyed with your series of using R base functions. It will be useful for us if you record another episode about nested loops in R

mukhtarabdi
Автор

Hey Pat,
What is the best practice when you want to populate a list but you don’t know upfront how long this might grow?
What you do in this case?

hassanhijazi