Learn R Programming

mmap (version 0.6-19)

mmap.csv: Memory Map Text File

Description

Reads a file column by column and creates a memory mapped object.

Usage

mmap.csv(file, 
         header = TRUE, 
         sep = ",", 
         quote = "\"", 
         dec = ".", 
         fill = TRUE, 
         comment.char = "", 
         row.names,
         ...)

Value

An mmap object containing the data from the file. All types will be set to the equivelant type from mmap as would be in R from a call to read.csv.

Arguments

file

the name of the file containing the comma-separated values to be mapped.

header

does the file contain a header line?

sep

field separator character

quote

the set of quoting characters

dec

the character used for decimal points in the file

fill

unimplemented

comment.char

unimplemented

row.names

what it says

...

additional arguments

Author

Jeffrey A. Ryan

Warning

At present the memory required to memory-map a csv file will be the memory required to load a single column from the file into R using the traditional read.table function. This may not be adequately efficient for extremely large data.

Details

mmap.csv is meant to be the analogue of read.csv in R, with the primary difference being that data is read, by column, into memory-mapped structs on disk. The intention is to allow for comma-separated files to be easily mapped into memory without having to load the entire object at once.

See Also

mmap, read.csv

Examples

Run this code
data(cars)
tmp <- tempfile()
write.csv(cars, file=tmp, row.names=FALSE)

m <- mmap.csv(tmp)

colnames(m) <- colnames(cars)

m[]

extractFUN(m) <- as.data.frame  # coerce list to data frame upon subset

m[1:3,]

munmap(m)

Run the code above in your browser using DataLab