Copiar matrices y big matrices
Si quieres copiar un objeto de tipo big.matrix, necesitas usar la función deepcopy(). Esto puede ser útil, especialmente si quieres crear objetos big.matrix más pequeños. En este ejercicio, copiarás un objeto big.matrix y mostrarás el comportamiento por referencia de este tipo de objetos.
Este ejercicio forma parte del curso
Procesamiento de datos escalable en R
Instrucciones del ejercicio
El objeto big.matrix mort está disponible en tu espacio de trabajo.
- Crea una nueva variable,
first_three, que sea una copia explícita demort, pero que incluya solo las tres primeras columnas. - Asigna otra variable,
first_three_2, afirst_three. - Establece el valor de la primera fila y primera columna de
first_threeenNA. - Comprueba que el cambio aparece en
first_three_2pero no enmort.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Use deepcopy() to create first_three
first_three <- ___(___, cols = ___,
backingfile = "first_three.bin",
descriptorfile = "first_three.desc")
# Set first_three_2 equal to first_three
___ <- ___
# Set the value in the first row and first column of first_three to NA
first_three[___, ___] <- NA
# Verify the change shows up in first_three_2
first_three_2[1, 1]
# but not in mort
mort[1, 1]