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

discrete

Discrete Vector tools


Description

discrete creates a discrete vector which is distinct from a continuous vector, or a factor/ordered vector. The other function are tools for manipulating descrete vectors.

Usage

as.discrete(x, ...)
## Default S3 method:
as.discrete(x, ...)
discrete(x, levels = sort(unique.default(x), na.last = TRUE), exclude = NA)
## S3 replacement method for class 'discrete'
x[...] <- value
## S3 method for class 'discrete'
x[..., drop = FALSE]
## S3 method for class 'discrete'
x[[i]]
is.discrete(x)
## S3 replacement method for class 'discrete'
is.na(x) <- value
## S3 replacement method for class 'discrete'
length(x) <- value

Arguments

x

a vector

drop

Should unused levels be dropped.

exclude

logical: should NA be excluded.

i

indexing vector

levels

charater: list of individual level values

value

index of elements to set to NA

...

arguments to be passed to other functions

Details

as.discrete converts a vector into a discrete vector.

discrete creates a discrete vector from provided values.

is.discrete tests to see if the vector is a discrete vector.

Value

as.discrete, discrete returns a vector of discrete type.

is.discrete returan logical TRUE if the vector is of class discrete other wise it returns FALSE.

Author(s)

Charles Dupont

See Also

Examples

a <- discrete(1:25)
a

is.discrete(a)

b <- as.discrete(2:4)
b

Hmisc

Harrell Miscellaneous

v4.5-0
GPL (>= 2)
Authors
Frank E Harrell Jr <fh@fharrell.com>, with contributions from Charles Dupont and many others.
Initial release
2021-02-27

We don't support your browser anymore

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