Learn R Programming

ffbase (version 0.6-2)

chunkexpr: Chunk an expression

Description

chunkexpr replaces variables in an expression with a indexed version. It main use it to rewrite "normal" R expression into chunked versions that can be evaluated in a chunked-for-loop.

Usage

chunkexpr(expr, x = all.vars(expr), i = ".i",
    prefix = "")

Arguments

expr
expression vector or language object
x
character with variables to be chunked
i
name of index that will be used in the for loop, typically a ri or hi.
prefix
prefix for variables to be replaced.

Examples

Run this code
expr <- expression( x <- 1)
ffbase:::chunkexpr(expr)
# results in: expression(x[.i] <- 1)

ffbase:::chunkexpr(expression(z <- x+y), c("y","z"), prefix="data$")
# results in: expression(data$z[.i] <- x + data$y[.i])

Run the code above in your browser using DataLab