Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 7. R Programming Structures > Default Values for Arguments - Pg. 172

The Boolean values TRUE and FALSE can be abbreviated as T and F (both must be capitalized). These values change to 1 and 0 in arithmetic expressions: > 1 < 2 [1] TRUE > (1 < 2) [1] 1 > (1 < 2) [1] 0 > (1 < 2) [1] TRUE > (1 < 2) [1] TRUE * (3 < 4) * (3 < 4) * (5 < 1) == TRUE == 1 In the second computation, for instance, the comparison 1 < 2 returns TRUE , and 3 < 4 yields TRUE as well. Both values are treated as 1 values, so the product is 1. On the surface, R functions look similar to those of C, Java, and so on. However, they have much more of a functional programming flavor, which has direct implications for the R programmer. 7.3 Default Values for Arguments In Section 5.1.2, we read in a data set from a file named exams : > testscores <- read.table("exams",header=TRUE)