Copying matrices and big matrices
If you want to copy a big.matrix object, then you need to use the deepcopy() function. This can be useful, especially if you want to create smaller big.matrix objects. In this exercise, you'll copy a big.matrix object and show the reference behavior for these types of objects.
Diese Übung ist Teil des Kurses
Scalable Data Processing in R
Anleitung zur Übung
The big.matrix object mort is available in your workspace.
- Create a new variable,
first_three, which is an explicit copy ofmort, but consists of only the first three columns. - Set another variable,
first_three_2tofirst_three. - Set the value in the first row and first column of
first_threetoNA. - Verify the change shows up in
first_three_2but not inmort.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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]