% Generated by roxygen2: do not edit by hand % Please edit documentation in R/s3.R \name{as_box} \alias{as_box} \alias{as_box_if} \title{Convert object to a box} \usage{ as_box(x, class = NULL) as_box_if(.x, .p, .class = NULL, ...) } \arguments{ \item{x, .x}{An R object.} \item{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, \code{class} is passed to \code{\link[=new_box]{new_box()}}.} \item{.p}{A predicate function.} \item{...}{Arguments passed to \code{.p}.} } \description{ \itemize{ \item \code{as_box()} boxes its input only if it is not already a box. The class is also checked if supplied. \item \code{as_box_if()} boxes its input only if it not already a box, or if the predicate \code{.p} returns \code{TRUE}. } }