Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Numbers
course content

Course Content

R Introduction: Part I

NumbersNumbers

In the previous section, we saw 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:

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

Yet, in our previous exercise, 10 was classified as a "double". To have R recognize it as an integer, appending L to the number is a straightforward method. For instance:

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

Task

  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 variable year.

Everything was clear?

Section 2. Chapter 2
toggle bottom row
some-alt