Last data update: 2014.03.03

R: Pads an object to a desired length, either with replicates of...
bufferR Documentation

Pads an object to a desired length, either with replicates of itself or another repeated object.

Description

Pads an object to a desired length, either with replicates of itself or another repeated object.

Usage

buffer(x, length.out = len(x), fill = NULL, preserveClass = TRUE)

Arguments

x

an R object

length.out

the desired length of the final output

fill

R object to fill empty rows in columns below the max size. If unspecified, repeats input rows in the same way as cbind.

preserveClass

determines whether to return an object of the same class as the original argument. Otherwise, returns a matrix.

Examples

buffer(c(1,2,3),20)
buffer(matrix(c(1,2,3,4),nrow=2),20)
buffer(list(1,2,3),20)
df<-data.frame(as.factor(c('Hello','Goodbye')),c(1,2))
buffer(df,5)
buffer((factor(x=c('Hello'))),5)

Results