Learn R Programming

rpsychi (version 0.3)

formatted: Convert a numeric vector into a character vector with the specified number of decimal place

Description

formatted convert a numeric vector into a character vector with the specified number of decimal place.

Usage

formatted(x, digits = 2)

Arguments

x
a numeric vector
digits
the specified number of decimal places (default 2)

Value

  • Return a character vector.

encoding

UTF-8

Examples

Run this code
data(infert)
x <- svar(infert$age)    #sample variance
formatted(x)
formatted(x, digits=4)

Run the code above in your browser using DataLab