sigfig: Scientific formatting of numbers

View source: R/sigfig.R

formatR Documentation

Scientific formatting of numbers

Description

Functions for concisely representing dimensionful quantities and uncertain quantities.

Usage

dimfig(data,dimension,thresh=1,...)

sigfig(est,VAR=NULL,SD=NULL,level=0.95,digits=2,...)

Arguments

data

A numerical vector of dimensionful quantities represented in SI units.

dimension

One of "length", "area", "time", "frequency", "speed", "diffusion", or "mass".

thresh

Threshold quantity for switching between units. E.g., 100 cm is represented as 1 m only if thresh>=1.

est

Can be either confidence-interval estimates with rows (lower-limit,point-estimate,upper-limit) or point estimates (with VAR or SD also specified).

VAR

Variance in the sampling distribution of x.

SD

Standard deviation in the sampling distribution of x.

level

Confidence level for designating the numerical precision of the significant digits.

digits

Number of significant digits to retain.

...

Not currently used.

Details

dimfig chooses the set of units that provides the most concise representation for data, and sigfig concisely represents statistical estimates with a fixed number of significant digits.

Value

dimfig returns a list with slots for the converted data and the name of the most concise units. sigfig returns a character string that is formated with the specified number of significant digits.

Author(s)

C. H. Fleming.

See Also

%#%

Examples


# Load package and data
library(ctmm)
data(buffalo)
DATA <- buffalo$Cilla

GUESS <- ctmm.guess(DATA,interactive=FALSE)
# in general, you want to run ctmm.select instead
FIT <- ctmm.fit(DATA,GUESS)

# raw summary (SI units)
summary(FIT,units=FALSE)

# default summary (concise units)
summary(FIT,units=TRUE)

# text-formatted summary
sigfig( summary(FIT)$CI )

ctmm documentation built on Sept. 24, 2023, 1:06 a.m.