safe.write {RMySQL} | R Documentation

## Write a data.frame avoiding exceeding memory limits

### Description

This function batches calls to `write.table` to avoid exceeding memory limits for very large data.frames.

### Usage

    safe.write(value, file, batch, ...)

### Arguments

`value` | a data.frame;
`file` | a file object (connection, file name, etc).
`batch` | maximum number of rows to write at a time.
`...` | any other arguments are passed to `write.table`.

### Details

The function has a while loop invoking `write.table` for subsets of `batch` rows of `value`. Since this is a helper function for `mysqlWriteTable`, it has hardcoded other arguments to `write.table`.

### Value

`NULL`, invisibly.

### Note

No error checking whatsoever is done.

### See Also

`write.table`

### Examples

    ## Not run:
       ctr.file <- file("dump.sqloader", "w")
       safe.write(big.data, file = ctr.file, batch = 25000)
    ## End(Not run)

[Package RMySQL version 0.6-0 Index]