Press "Enter" to skip to content

What are objects in R?

Zigya Acadmey 0

In every computer language variables provide a means of accessing the data stored in memory.

R does not provide direct access to the computer’s memory but rather provides a number of specialized data structures we will refer to as objects. These objects are known as symbols or variables. 

In R, however, the symbols are themselves objects and can be manipulated in the same way as any other object. This is different from many other languages and has wide-ranging effects.

Type of Objects

There are 5 basic types of objects in the R language:

  1. Vectors
  2. Lists
  3. Matrices
  4. Factors
  5. Data Frames

Creating object in R

All objects in R have a given type. we already know some common data types which are used in mathematics. Integers, floating-point numbers, or floats, matrices, etc, are all objects you are already familiar with. But R has other, maybe lesser-known data types (that you can find in a lot of other programming languages) that you need to become familiar with. But first, we need to learn how to assign a value to a variable. There are two ways to do this:

> a <- "hello world"
> b <- 2


> a = "hello world"
> b = 2

Preforming simple athematic operation

Just like any other language, you can perform all common math operations like addition, subtraction, division.


> a <- 10
> b <- 2
> print(a + b)


> a <- 10
> b <- 2
> print(a - b)


> a <- 10
> b <- 2
> print(a / b)


Hence, we saw what are objects in R and how to use them.

This brings the end of this Blog. We really appreciate your time.

Hope you liked it.

Do visit our page for more informative blogs on Data Science

Keep Reading! Cheers!

Zigya Academy

Leave a Reply

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