How to write an if else block in R and how its different from ifelse and if_else (CC175)

Описание к видео How to write an if else block in R and how its different from ifelse and if_else (CC175)

An if else block is an effective tool for using conditional statements to control the flow of data through an R script. In this Code Club, Pat gives a tutorial on how to write blocks containing a single if statement, if else statements and if else if else statements. He'll also demonstrate how this approach is different from using the ifelse and if_else functions. 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

You can find my blog post for this episode at https://www.riffomonas.org/code_club/....

The data were generated in our Kozich et al. 2013 paper (http://doi.org/10.1128/AEM.01043-13) using samples from the Schloss et al. 2012 paper (http://doi.org/10.4161/gmic.21008).

#conditional #R #Rstats #baseR

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.

If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/

0:00 Using if else blocks to control flow through a script
2:03 Does our code for lower triangular matrix also work for a square matrix?
6:20 Why ifelse (or if_else) won't work
11:14 How to write if ... else blocks
13:45 How to write if ... else if ... else blocks

Комментарии

Информация по комментариям в разработке