Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Data Types | Basic Data Types and Vectors
R Introduction: Part I

Data Types

Understanding data types is fundamental in R programming as they dictate how data is stored, interpreted, and manipulated, so let's explore the various data types in R and their characteristics.

A data type in R defines the kind of value a variable can hold and the operations that can be performed on it. It determines how the data is stored, interpreted, manipulated, and the amount of memory it occupies.

Each data type serves specific purposes and ensures that the data is handled appropriately according to its nature.

Here are the most common data types in R:

Type Description
double Represents real numbers (double-precision floating-point).
integer Represents whole numbers.
character Represents text strings.
logical Represents Boolean values (TRUE or FALSE).

To determine the data type of a given variable, you would use the typeof() function, providing the respective variable name as its argument. For example:

Take the initiative to practice this function on your own!

Task

  1. Assign the number 10 to a variable named chapter.
  2. Display the data type of the chapter variable.

Everything was clear?

Section 2. Chapter 1
toggle bottom row
course content

Course Content

R Introduction: Part I

Data Types

Understanding data types is fundamental in R programming as they dictate how data is stored, interpreted, and manipulated, so let's explore the various data types in R and their characteristics.

A data type in R defines the kind of value a variable can hold and the operations that can be performed on it. It determines how the data is stored, interpreted, manipulated, and the amount of memory it occupies.

Each data type serves specific purposes and ensures that the data is handled appropriately according to its nature.

Here are the most common data types in R:

Type Description
double Represents real numbers (double-precision floating-point).
integer Represents whole numbers.
character Represents text strings.
logical Represents Boolean values (TRUE or FALSE).

To determine the data type of a given variable, you would use the typeof() function, providing the respective variable name as its argument. For example:

Take the initiative to practice this function on your own!

Task

  1. Assign the number 10 to a variable named chapter.
  2. Display the data type of the chapter variable.

Everything was clear?

Section 2. Chapter 1
toggle bottom row
some-alt