Creating a data.table
Just like how the data.frame() function can be used to create a data frame, you can create a data.table using the data.table() function. In this exercise, you will create the following data.table:
X
id value
1: a 0.5
2: b 1.0
3: c 1.5
Este ejercicio forma parte del curso
Data Manipulation with data.table in R
Instrucciones del ejercicio
- Load the
data.tablepackage. - Create the data.table
Xshown above. Note that the columnidis of typecharacterandvalueis of typenumeric.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Load data.table
library(___)
# Create the data.table X
X <- ___(___ = c("a", "b", "c"), ___ = c(0.5, 1.0, 1.5))
# View X
X