Connect with us

Hi, what are you looking for?


Data Types In R Programming

Data Types In R Programming
Data Types In R Programming

R data types are so important for statistics projects and data science projects. We going to learn Vector, Lists, Matrix, Factor, Missing Values, Names Attributes, and Data Frames, also going to examine Object and Attributes.

What Is Data Types?

datatype or simply type is a data attribute that tells the compiler or interpreter how the programmer is going to use the data. If you know another programming language your job will be easier.

Object And Attributes

An object can be a variable, data structure, function, or method, so it is a value referenced by an identifier in memory also everything is an object in R.

R objects can have many related properties called attributes. These properties explain what an object represents and how it should be interpreted by R. Quite often, the only difference between two similar objects is that they have different attributes.

Vectors And Lists

Vectors are used to combine objects, similar to the list, but the two concepts are not the same, so I took the same title. Before creating a vector, we going to look at the value assignment syntax.

Varaible Assaigment Syntax Generally, value assignment syntax this is.

List Vs Vector
  • Vectors are one-dimensional, while lists are multi-dimensional objects.
  • Lists are recursive, whereas vector is not.
  • A list holds different data such as Numeric, Character, etc. Vector stores elements of the same type or converts implicitly.

A matrix is ​​an R object in which the elements are arranged in a two-dimensional rectangular layout. They contain elements of the same atomic type.


used to categorize data, sorted by their values. For example, we have a vector and we want to categorize by vector value, we can use for this.

Your main categories are found in the section where the output says level. For example, this code level is A B C because we just use A B C value.

Missing Value

In the R programming language, impossible values ​​are represented as NaN (Not a Number), but empty values, or missing values as Na. “Missing Value” is used to find empty values ​​in a data set. They are more useful in large data sets, for example, they can be used to detect empty data in large data.

We have 3 NA so this command going to find 3 NA every it will write TRUE in that index after every value it finds so our output will be as follows.


Names Attribute

is used to name an object. For example, we have a vector and we want to give a name to this vector, we can use Names Attribute.

We create a simple list after that we changed the name of every index. Don’t forget if you don’t use the names function you can’t see names.

Data Frames

Data frames are similar to matrices, but data frames do not have to work in a single type. For example, you can use together with an integer a string.


Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like


This article was created for those who want to use functional programming in their career or who are learning new programming paradigms. We will...


Functions are pieces of code that combine the integrity of the code used to perform a task into a single structure. If you are...


Computers can solve an event in different ways, we call these ways algorithms, each algorithm works differently from the others and has different processing...

Data Science

SQL (Structured Query Language) is one of the most used tools by data scientists, data analysts, and data engineers. Almost all companies use a...