-
Book Overview & Buying
-
Table Of Contents
Machine Learning For Dummies
By :
So far, the chapter demonstrates various data structures and techniques for working with them. However, just creating a data structure isn’t enough in many cases. The following sections provide an overview of some basic tasks you can use to perform statistical analysis. These sections help you understand some of the examples later in the book.
Making decisions
To perform useful work, computer languages provide the means for making decisions. R provides three decision-making structures: if, if…else, and switch. Use the if forms when you make decisions with a limited number of outcomes. The switch form works best when you make a decision with multiple outcomes. The following sections describe these decision-making structures in more detail.
Using the if statement
The if statement lets you make a simple decision. When something is true, R executes the code in the associated code block. Here is an example of the if statement in action:
A...
Change the font size
Change margin width
Change background colour