Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as_box

Convert object to a box


Description

  • as_box() boxes its input only if it is not already a box. The class is also checked if supplied.

  • as_box_if() boxes its input only if it not already a box, or if the predicate .p returns TRUE.

Usage

as_box(x, class = NULL)

as_box_if(.x, .p, .class = NULL, ...)

Arguments

x

An R object.

class, .class

A box class. If the input is already a box of that class, it is returned as is. If the input needs to be boxed, class is passed to new_box().

.x

An R object.

.p

A predicate function.

...

Arguments passed to .p.


rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.