An expression in R returns some value such as a scalar value, numeric vector, character string, list, etc.
As simple arithmetic expression lets convert 65 degrees Fahrenheit to Centigrade: (65-32)*5/9
As a more elaborate example, the probability of straight in a hand of poker
is:
(10*choose(4,1)^5 - 10*choose(4,1))/choose(52,5)
which evaluates to 0.003924647,
where a straight in poker is five cards in the correct order with no
restriction on suit and aces are allowed to count high or low.
Assignment is considered an expression whose value is the value being
assigned. For example:
x <- 2 + y <- 33
will assign 35 to x and 33 to y.
Expression can be grouped by separating them by a semicolon and surrounding
the group by braces. The value of a grouped
expression, is the value of the last expression evaluated. For
example:
{x <- 35; y <- 33; z <- 0; NULL}
makes the indicated assignments and then returns NULL.
The above one-liner is equivalent to the multi-liner:
{
x <- 35
y <- 33
z <- 0
NULL
}