Learn R Programming

spm2 (version 1.1.3)

decimaldigit: Digit number after decimal point for a numeric variable

Description

This function is to derive the digit number after decimal point for a numeric variable (e.g., lat and long).

Usage

decimaldigit(x, dechar = ".", nint = NA, ndec = NA, pad.left = TRUE)

Value

A list of integer number to show digit number after decimal point of x.

Arguments

x

one or more decimal numbers.

dechar

The character used to separate the decimal part of a number.

nint

The number of characters to which the integer part of the numbers should be padded.

ndec

The number of characters to which the decimal part of the numbers should be padded.

pad.left

Whether the left (integer) side of the numbers should be padded as well as the right.

Author

Jin Li

References

Jim Lemon and Philippe Grosjean (2019). 'prettyR': Pretty Descriptive Stats. R package version 2.1.1. https://CRAN.R-project.org/package=prettyR.

Examples

Run this code

x<-c(0.1, 2.2, 3.03, 44.444, 555.0005, 6666.66666)
decimaldigit(x)

Run the code above in your browser using DataLab