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

Contenido del Curso

R Introduction: Part I

R Introduction: Part I

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

bookLogical Types

Let's now turn our attention to logical data types.

For instance, if you evaluate 2 > 1, it will return TRUE because 2 is indeed greater than 1. This principle will be highly relevant in later chapters.

Numbers and strings (text) can also be converted to logical types. Any number except 0 will be converted to TRUE (0 converts to FALSE), and the strings 'F', 'false', 'False', and 'FALSE' will convert to the logical FALSE. The same principle applies for logical TRUE.

When converting logical values to numbers, FALSE becomes 0, and TRUE becomes 1.

Tarea
test

Swipe to show code editor

  1. Assign the result of the expression 19*54 > 76*13 to the variable logic.
  2. Show the value of the logic variable.
  3. Show the data type of the logic variable.
  4. Convert the logic variable to an integer and show the result.

Avoid using the print() function.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 4
toggle bottom row

bookLogical Types

Let's now turn our attention to logical data types.

For instance, if you evaluate 2 > 1, it will return TRUE because 2 is indeed greater than 1. This principle will be highly relevant in later chapters.

Numbers and strings (text) can also be converted to logical types. Any number except 0 will be converted to TRUE (0 converts to FALSE), and the strings 'F', 'false', 'False', and 'FALSE' will convert to the logical FALSE. The same principle applies for logical TRUE.

When converting logical values to numbers, FALSE becomes 0, and TRUE becomes 1.

Tarea
test

Swipe to show code editor

  1. Assign the result of the expression 19*54 > 76*13 to the variable logic.
  2. Show the value of the logic variable.
  3. Show the data type of the logic variable.
  4. Convert the logic variable to an integer and show the result.

Avoid using the print() function.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 4
toggle bottom row

bookLogical Types

Let's now turn our attention to logical data types.

For instance, if you evaluate 2 > 1, it will return TRUE because 2 is indeed greater than 1. This principle will be highly relevant in later chapters.

Numbers and strings (text) can also be converted to logical types. Any number except 0 will be converted to TRUE (0 converts to FALSE), and the strings 'F', 'false', 'False', and 'FALSE' will convert to the logical FALSE. The same principle applies for logical TRUE.

When converting logical values to numbers, FALSE becomes 0, and TRUE becomes 1.

Tarea
test

Swipe to show code editor

  1. Assign the result of the expression 19*54 > 76*13 to the variable logic.
  2. Show the value of the logic variable.
  3. Show the data type of the logic variable.
  4. Convert the logic variable to an integer and show the result.

Avoid using the print() function.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Let's now turn our attention to logical data types.

For instance, if you evaluate 2 > 1, it will return TRUE because 2 is indeed greater than 1. This principle will be highly relevant in later chapters.

Numbers and strings (text) can also be converted to logical types. Any number except 0 will be converted to TRUE (0 converts to FALSE), and the strings 'F', 'false', 'False', and 'FALSE' will convert to the logical FALSE. The same principle applies for logical TRUE.

When converting logical values to numbers, FALSE becomes 0, and TRUE becomes 1.

Tarea
test

Swipe to show code editor

  1. Assign the result of the expression 19*54 > 76*13 to the variable logic.
  2. Show the value of the logic variable.
  3. Show the data type of the logic variable.
  4. Convert the logic variable to an integer and show the result.

Avoid using the print() function.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 4
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt