As stated in CloudStat Intro, we know that CloudStat is based on R Language, an object orientated language, everything in R is an object. Each object has a class. The simplest data objects are one-dimensional arrays called vectors, consisting of any number of elements. For example, the calculation:
results in a vector, from the numeric class (as it contains a number), with just one element. Note that the command “1+1” is itself and object of the expression class
The simplest elements produce vectors of the following classes:
- logical: The values T (or TRUE) and F (or FALSE).
- integer: Integer values such as 2 or -5.
- numeric: Floating-point real numbers (double-precision by default).
Numerical values can be written as
whole numbers (for example, 2, -5),
decimal fractions (2.38, -23.125), or in
scientific notation (2.38e57, 23e-98).
- complex: Complex numbers of the form a + bi, where a and b are integers or numeric (for example, 5 + 4.67i).
- character: character strings enclosed by matching double quotes (“) or apostrophes ( ’), for example, “CloudStat”, ’data analysis’.
Example: #2 Data Classes Example
> T; F #Logical
> 2; -5 #Integer
> 2; -5 #Whole number
> 2.38; -23.125 #Decimal fractions
> 2.38e57; 23e-98 #Scientific notation
> 5 + 4.67i #Complex number
> "CloudStat"; "data analysis" #Character
 "data analysis"
Two other elements which are particularly useful are:
- factors: These represent labelled observations. For example sex is a factor, generally incorporating two levels: male and female. These are generally used to represent qualitative effects in models.
- ordered factors: A factor where the levels are ordered. For example there may be three responses to a question about quality, high, medium or low, but each level is not necessarily on a linear scale.
Source: An Introduction to R: Examples for Actuaries by Nigel De Silva