Starting in R
sorry: |
This section is still under construction! This article was last modified on 01/6/2015. If you have comments please use the Discussion page or contribute to the article! |
R is an "object-oriented" programming language. Each object has data fields which are attributes that describes the object. The script defines how these objects are created, imported or exported, and also the interaction among them. The result of the calculus is always a new object, which can be stored (assigned), or only displayed in the console. There are many different types of objects in R. Moreover, the information inside the objects has different data modes. Below, the most frequent types of objects and data modes are introduced.
Types of objects in R
Even though there are many different types of objects in R, here we will only present the most frequent. Each object has different ways of accessing to the data stored inside. Hereinafter the different types of objects are listed and the way to access to the data is explained.
Vector.
It is an object with only one dimension. To show how to access to the data, lets create an object named v which contains the 9 integer numbers, from 1 to 9. This vector can be created by using the c() function, where the arguments are the numbers to be concatenate in a vector. The "arrow" <- assigns the vector to the object named v.