Learn R Programming

ptvalue (version 0.2.0)

ptvalue: ptvalue: Working with precision teaching values

Description

This class allow to print precision teaching measures with the times or the division symbols (ex. \(\times 2\), \(\div 1.4\)) by converting numeric values to precision teaching values. More specifically, providing:

  • Values between \( ] 0, 1 [ \) will return output values \( \geq 1 \) with a prefixed div (\(\div\)) symbol (ex. ).

  • Values between \([ 1, \infty [\) will return output values \( \geq 1\) with a prefixed times (\(\times\)) symbol.

  • Values of \( 0 \) will return \(\div\)Inf.

  • Inf values will return \(\times\)Inf.

  • NA values will return NA.

Usage

ptvalue(x = double())

is_ptvalue(x)

as_ptvalue(x, ...)

# S3 method for default as_ptvalue(x, ...)

Value

A numeric vector of class ptvalue that represents precision teaching measures.

Arguments

x

A numeric vector. Values must be \(\geq 0\).

...

Other values passed to method.

See Also

times(), div()

Examples

Run this code
# Basic examples
x <- c(0.5, 0.8, 1, 1.25, 2)
ptvalue(x)

ptvalue(0)
ptvalue(NA)
ptvalue(Inf)

# For convenience, `div()` can be used to
# create decaying values without using decimal values
ptvalue(c(0.5, 0.8))
div(c(2, 1.25))

x <- ptvalue(2)
is_ptvalue(x)

x <- 2
is_ptvalue(x)

x <- c(0.5, 1, 2)
as_ptvalue(x)

Run the code above in your browser using DataLab