Learn R Programming

dibble (version 0.3.0)

broadcast: Broadcast to a new dimension

Description

Broadcasts the dimension of the object to a new dimension.

Usage

broadcast(x, dim_names = NULL, ...)

# S3 method for default broadcast(x, dim_names = NULL, ...)

# S3 method for ddf_col broadcast(x, dim_names, ...)

# S3 method for tbl_ddf broadcast(x, dim_names, ...)

Value

A dibble.

Arguments

x

A dibble, vector, or array.

dim_names

A character vector or list of dimension names.

...

Unused, for extensibility.

Details

Operations between dibbles are automatically broadcasted, but for safety reasons, warnings are issued. broadcast() can suppress the warnings if dim_names matches the dimension of x.

Examples

Run this code
x <- broadcast(1:2,
               list(axis1 = letters[1:2]))
y <- broadcast(1:3,
               list(axis2 = letters[1:3]))
broadcast(x * y, c("axis1", "axis2"))

Run the code above in your browser using DataLab