zipr: zip two vector-like objects into a dataframe

Description Usage Arguments Value Examples

View source: R/zipr.R

Description

zip two vector-like objects into a dataframe

Usage

1
2
zipr(x = x, y = x, broadcast = FALSE, fill = FALSE,
  fillvalue = c(NA))

Arguments

x

vector-like object

y

vector-like object

broadcast

defaults to FALSE; if TRUE, shorter sequence is repeated until its length is equal to that of the longer sequence

fill

defaults to FALSE; bool for whether fillvalue should be implemented

fillvalue

value or sequence of value(s) to fill in shorter sequence until it is the same length as the longer sequence. Defaults to NA

Value

A dataframe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
a <- c(1,2,3)
b <- c(4,5,6)
c <- c(1,2,3,4,5,6)
d <- c(7,8)
z <- c(9)
filler <- c(NA)

# zip two vectors of the same length
zipr(a,b)

# zip two vectors of different lengths, repeating the shorter vector
zipr(a, z, broadcast = TRUE)

# zip two vectors of different lengths, using the default fill value
zipr(z, a, fill = TRUE)

# zip two vectors of different lengths, using a custom fill value
zipr(c,a, fill = TRUE, fillvalue = z)

leslie-huang/zipR documentation built on Nov. 5, 2018, 5:20 p.m.