Usually, when programming in any programming language, you need to use various variables to store all kinds of information. Variables are just storage locations for reserved values. This means that when you create a variable, you must reserve some space in memory to store them.
You may want to store information of various data types, such as characters, wide characters, integers, floating points, double floating points, Boolean, etc. Based on the data type of variables, the operating system allocates memory and decides which can be stored in reserved memory.
Contrary to other programming languages, such as C and java in C, variables are not declared as a certain data type. Assign an R object to a variable, and the data type of the R object becomes the data type of the variable. Although there are many types of R objects, they are often used:
vectors
matrix
rank
factor
data frames
Tabulation/listing
(1) basic data type
Among these objects, the simple ones are vector objects. These vectors have six data types, also called six vectors. Other r objects are based on atomic vectors.
Data type case check
Logical (logical) truth and falsehood
V<- that's right
Printing (category 5)
It will produce the following results-
[1,] "yellow" "green" "yellow"
[2] "Green", "Yellow" and "Green"
[3] Yellow, Green and Yellow
(6) Factors
A factor is an r object created using a vector. Zhaotong Beida Jade Bird thinks that it stores the vector and the different values of the elements in the vector as labels. The label is always a character, whether it is a number, a character or a Boolean value in the input vector. They are very useful in statistical modeling.