The R language: “Words” and “sentences”
Pedro José Aphalo · 2020
This chapter focuses on learning how to issue textual commands at the command prompt. It shows the equivalent of the R code in mathematical notation. Computer languages have strict rules and interpreters and compilers are unforgiving about errors. They will issue error messages, but in contrast to human readers or listeners, will not guess people intentions and continue. Character variables can be used to store any character. Character constants are written by enclosing characters in quotes. Variables have a mode that depends on what is stored in them. But different from other languages, assignment to a variable of a different mode is allowed and in most cases its mode changes together with its contents. Factors are used to indicate categories, most frequently the factors describing the treatments in an experiment, or categories in a survey. They can be created either from numerical or character vectors.