Aan de slagGa gratis aan de slag

Reading a big.matrix object

In this exercise, you'll create your first file-backed big.matrix object using the read.big.matrix() function. The function is meant to look similar to read.table() but, in addition, it needs to know what type of numeric values you want to read ("char", "short", "integer", "double"), it needs the name of the file that will hold the matrix's data (the backing file), and it needs the name of the file to hold information about the matrix (a descriptor file). The result will be a file on the disk holding the value read in along with a descriptor file which holds extra information (like the number of columns and rows) about the resulting big.matrix object.

Deze oefening maakt deel uit van de cursus

Scalable Data Processing in R

Cursus bekijken

Oefeninstructies

  • Load the bigmemory package.
  • Use the read.big.matrix() function to read a file called "mortgage-sample.csv", which contains a header and is composed of integer values. In addition:
    • Create a backingfile called "mortgage-sample.bin", and
    • A descriptor file called "mortgage-sample.desc".
  • Find the dimensions of x using the dim() function.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Load the bigmemory package
___

# Create the big.matrix object: x
x <- ___(___, header = ___, 
                     type = ___, 
                     backingfile = ___, 
                     descriptorfile = ___)
    
# Find the dimensions of x
___
Code bewerken en uitvoeren