官术网_书友最值得收藏!

  • R Programming By Example
  • Omar Trejo Navarro
  • 154字
  • 2021-07-02 21:30:39

Complex logic with control structures

The final topic we should cover is how to introduce complex logic by using control structures. When I write introduce complex logic, I don't mean to imply that it's complex to do so. Complex logic refers to code that has multiple possible paths of execution, but in reality, it's quite simple to implement it.

Nearly every operation in R can be written as a function, and these functions can be passed through to other functions to create very complex behavior. However, it isn't always convenient to implement logic that way and using simple control structures may be a better option sometimes.

The control structures we will look at are if... else conditionals, for loops, and while loops. There are also switch conditionals, which are very much like if... else conditionals, but we won't look at them since we won't use them in the examples contained in this book.

主站蜘蛛池模板: 禄丰县| 长泰县| 广灵县| 东方市| 英德市| 禹城市| 武邑县| 永丰县| 林西县| 镇坪县| 大埔县| 彭水| 枣阳市| 清水河县| 分宜县| 德江县| 永吉县| 汶川县| 景宁| 伊川县| 师宗县| 奉新县| 东宁县| 江孜县| 叶城县| 日照市| 龙井市| 安吉县| 上饶市| 怀集县| 顺昌县| 万荣县| 土默特左旗| 舟山市| 西乌珠穆沁旗| 孝感市| 即墨市| 马公市| 华池县| 腾冲县| 莒南县|