ComenzarEmpieza gratis

Create data objects in R

In this exercise you will create several types of data objects in R. First you will create a scalar object with one value that can then be used to compute other scalar objects. You will also create three vectors: one with numeric values, one with character values and one with logical TRUE and FALSE values.

Este ejercicio forma parte del curso

R For SAS Users

Ver curso

Instrucciones del ejercicio

  • Assign the value of 1 to an object x, then create an object w by adding 4 to x.
  • Create a vector object y consisting of three numbers 5, 2 and 3.
  • Create a vector object z consisting of three words "red", "green", "blue".
  • Create a logical object v with the first two elements TRUE and last element FALSE.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Assign the value of 1 to an object x
___ <- 1

# Create object w by adding the value 4 to x
___ <- ___ + ___

# Create vector object y 
y <- c(___, ___, ___)

# Create a vector z 
___

# Create a logical object v 
___
Editar y ejecutar código