Learn R Programming

rock (version 0.8.1)

syncing_df_expand: Expand a vector or data frame

Description

Expand a vector or data frame

Usage

syncing_df_expand(
  x,
  newLength,
  fill = TRUE,
  expandFun = NULL,
  silent = rock::opts$get("silent")
)

syncing_vector_expand( x, newLength, fill = TRUE, expandFun = NULL, silent = rock::opts$get("silent") )

Value

The expanded vector

Arguments

x

The vector or data frame

newLength

The new length (or number of rows for a data frame)

fill

When expanding streams, whether to duplicate elements to fill the resulting vector. Ignored if fillFun is specified.

expandFun

If specified, when expanding streams, instead of potentially filling the new larger vector with elements (if fill is TRUE), the vectors are passed to function expandFun, which must accept a vector (to compress) and a single integer (with the desired resulting length of the vector).

silent

Whether to be silent or chatty.

Examples

Run this code
rock::syncing_vector_expand(letters[1:10], 15);
rock::syncing_vector_expand(letters[1:10], 15, fill=FALSE);

Run the code above in your browser using DataLab