v_continuous_nonneg: Non-negative continuous vectors

v_continuous_nonnegR Documentation

Non-negative continuous vectors

Description

Constructors and methods for a nonnegative continuous data type. v_continuous_nonneg and nneg are synonyms that each create a new v_continuous_nonneg object subclassed from v_continuous and vctrs_vctr.

Support: the nonnegative Reals* (plus NA_real_)
Prototype: double
* - i.e. floating-point number

Usage

v_continuous_nonneg(
  x = ptypeFUN(),
  internal_name = "",
  context,
  auto_compute_summary = auto_compute_default,
  extra_descriptors = list()
)

nneg(
  x = ptypeFUN(),
  internal_name = "",
  context,
  auto_compute_summary = auto_compute_default,
  extra_descriptors = list()
)

is_continuous_nonneg(x)

is_nonneg(x)

as_nonneg_continuous(x)

as_continuous_nonneg(x)

## S3 method for class 'v_continuous_nonneg'
as_canonical(x)

Arguments

x

nonnegative double

internal_name

the internal name of the variable

context

a context

auto_compute_summary

an indicator of whether the data_summary is automatically computed whenever a vector is initialized, subset, or concatenated. Defaults to TRUE. If this option is set to FALSE, then get_data_summary is the only way to compute the summary. The data_summary_l lens will return an empty data_summary.

extra_descriptors

A list of descriptors functions appended to the default descriptors.

See Also

Other stype types: tbl_analysis, v_binary, v_continuous, v_count, v_nominal, v_ordered, v_proportion, v_rcensored

Examples

# Example data
src_dbl <- c(1, 2.5, 4, 5.5, NA_real_)

# Constructor for the `v_continuous_nonneq` class. One can also use `nneg`
# which is a synonym for the `v_continuous_nonneg` function.
v <- v_continuous_nonneg(
  x = src_dbl,
  internal_name = "v_example",
  context = context(
    short_label = "important_var",
    long_label  = "Very important variable"
  ),
  extra_descriptors = list()
)

# Helper functions and methods
is_continuous_nonneg(v)
as_nonneg_continuous(src_dbl)
as.character(v)
as_canonical(v)

novisci/stype documentation built on July 28, 2022, 7:44 a.m.