Learn R Programming

yyjsonr (version 0.1.21)

as_scalar: Tag an atomic vector with a single element as class 'scalar'. When output to JSON it will be output as a scalar not a vector

Description

Tag an atomic vector with a single element as class 'scalar'. When output to JSON it will be output as a scalar not a vector

Usage

as_scalar(x)

Value

If x is an atomic vector with length = 1, then object is returned with class 'scalar', otherwise object is returned unmodified

Arguments

x

atomic vector with length = 1