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

Conteúdo do Curso

R Introduction: Part I

R Introduction: Part I

1. Basic Syntax and Operations
2. Basic Data Types and Vectors
3. Factors

Numbers

In the previous section, we observed that the number 10 was identified as a double even though it is an integer. Let's delve into this peculiarity.

R can categorize numeric values into several types, which are:

  • double - representing real numbers;
  • integer - for whole numbers;
  • complex - for numbers with both a real and an imaginary part.

To have R recognize 10 as an integer instead of a double, you can append L to the number. Here’s how you can do it:

12
typeof(10) # Example of double type typeof(10L) # Example of integer type
copy

Differentiating between 10 and 10L is important because of how memory is utilized — integers take up less space.

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 2. Capítulo 2
toggle bottom row

Numbers

In the previous section, we observed that the number 10 was identified as a double even though it is an integer. Let's delve into this peculiarity.

R can categorize numeric values into several types, which are:

  • double - representing real numbers;
  • integer - for whole numbers;
  • complex - for numbers with both a real and an imaginary part.

To have R recognize 10 as an integer instead of a double, you can append L to the number. Here’s how you can do it:

12
typeof(10) # Example of double type typeof(10L) # Example of integer type
copy

Differentiating between 10 and 10L is important because of how memory is utilized — integers take up less space.

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

Seção 2. Capítulo 2
toggle bottom row

Numbers

In the previous section, we observed that the number 10 was identified as a double even though it is an integer. Let's delve into this peculiarity.

R can categorize numeric values into several types, which are:

  • double - representing real numbers;
  • integer - for whole numbers;
  • complex - for numbers with both a real and an imaginary part.

To have R recognize 10 as an integer instead of a double, you can append L to the number. Here’s how you can do it:

12
typeof(10) # Example of double type typeof(10L) # Example of integer type
copy

Differentiating between 10 and 10L is important because of how memory is utilized — integers take up less space.

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

In the previous section, we observed that the number 10 was identified as a double even though it is an integer. Let's delve into this peculiarity.

R can categorize numeric values into several types, which are:

  • double - representing real numbers;
  • integer - for whole numbers;
  • complex - for numbers with both a real and an imaginary part.

To have R recognize 10 as an integer instead of a double, you can append L to the number. Here’s how you can do it:

12
typeof(10) # Example of double type typeof(10L) # Example of integer type
copy

Differentiating between 10 and 10L is important because of how memory is utilized — integers take up less space.

Tarefa

  1. Assign the current year's numerical value to a variable named year, and ensure that it is of integer type by appending L.
  2. Determine and display the type of the year variable:

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 2. Capítulo 2
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt