Memory Map Text File
Reads a file column by column and creates a memory mapped object.
mmap.csv(file, header = TRUE, sep = ",", quote = "\"", dec = ".", fill = TRUE, comment.char = "", row.names, ...)
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 |
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.
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
.
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.
This is currently a very simple implementation to facilitate exploration of the mmap package. While the interface will remain consistent with read.csv from utils, more additions to handle various out-of-core types available in mmap as well as performance optimization will be added.
Jeffrey A. Ryan
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.