% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tileD.R
\name{tileData}
\alias{tileData}
\title{Tile And Write Tiled Data To Disk}
\usage{
tileData(readpath, writepath = NULL, rows, splits, ...)
}
\arguments{
\item{readpath}{character length 1. Full path to the source file}

\item{writepath}{character length 1. Full path to the destination file}

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

\item{splits}{integer, length 1. Number of vertical data splits in each above subset. See \link{splitV}}

\item{...}{extra arguments to \link{splitH} e.g. \code{dropcols} for columns dropped from source data}
}
\value{
A \link[listenv]{listenv} of "data.table" class tiles. When \code{writepath} is given, it produces
a "rds" file containing data tiles.
}
\description{
Splits long and wide data files in lists of disjoint tiles for further processing.
}
\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 \code{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 \strong{callr} package documentation.
}
\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)
}


}
\seealso{
\link{splitH}, \link{splitV}, \link{tileHot}, \link[base]{readRDS}
}
\keyword{splitting}
