tileData: Tile And Write Tiled Data To Disk

View source: R/tileD.R

tileDataR Documentation

Tile And Write Tiled Data To Disk

Description

Splits long and wide data files in lists of disjoint tiles for further processing.

Usage

tileData(readpath, writepath = NULL, rows, splits, ...)

Arguments

readpath

character length 1. Full path to the source file

writepath

character length 1. Full path to the destination file

rows

integer length 1. Number of rows in each subset. Internally, it determines the total number of subsets before the vertical split

splits

integer, length 1. Number of vertical data splits in each above subset. See splitV

...

extra arguments to splitH e.g. dropcols for columns dropped from source data

Details

Facilitates local operations on small size tiles by partitioning the data horizontally and vertically. The list of tiles can be written to disk as "rds" file when a writepath destination is given. The written data can then be read entirely or in subsets (see Example 2).

NOTE: This utility uses background processing. Check "Security Considerations" in callr package documentation.

Value

A listenv of "data.table" class tiles. When writepath is given, it produces a "rds" file containing data tiles.

See Also

splitH, splitV, tileHot, readRDS

Examples


if (interactive()) {

# Make a 'csv' file

data(iris)
tmpf = tempfile(fileext = '.csv')
write.table(iris, tmpf , sep = ',', row.names = FALSE, quote = FALSE)

# 1. Tile data

a = tileData(tmpf, rows = 10, splits = 3)     # 10x2 and 10x1 tiles
class(a)                                      # listenv, environment
str(a)                                        # nested list

tmpf1 = tempfile(fileext = '.rds')            # new location

# 2. Write tiled data

tileData(tmpf, tmpf1, rows = 10, splits = 3)
a = readRDS(tmpf1)[[1]]                  # partial read from new location
print(a)                                     # list component

unlink(tmpf)
unlink(tmpf1)
}



akin documentation built on May 19, 2026, 5:07 p.m.