
CHAPTER 1
Basic Data Analysis
1.1 R Programming Conventions
Like any programming language, R has certain conventions. Here are the basic rules.
R Conventions
Numbers A point is used as a decimal separator. Numbers can be written
in exponential form; the exponential part is introduced by E.
Numbers can be complex numbers; the imaginary part is marked
by i.
Example: 1
2.3
3.4E5
6i+7.8
Numbers can take the values Inf, -Inf, NaN for “not a number”
and NA for “not available” = missing.
Example: 1/0 results in Inf
0/0 results in NaN
NA is used as a placeholder for missing numbers.
Strings Strings are delimited by " or '.
Example: "ABC"
'def'
"gh'ij"
Comments Comments