formatSPSS: Format Objects

Description Usage Arguments Value Author(s) Examples

View source: R/format.R

Description

Format an object for printing, mostly used to print numeric data in the same way SPSS. This is mainly for internal use in print methods.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
formatSPSS(x, ...)

## Default S3 method:
formatSPSS(x, ...)

## S3 method for class 'integer'
formatSPSS(x, ...)

## S3 method for class 'numeric'
formatSPSS(x, digits = 3, ...)

## S3 method for class 'matrix'
formatSPSS(x, ...)

## S3 method for class 'data.frame'
formatSPSS(x, ...)

Arguments

x

an R object, typically numeric. Currently methods are implemented for vectors, matrices and data frames. The default method calls as.character.

...

additional arguments passed down to methods.

digits

an integer giving the number of digits after the comma to display.

Value

A character vector or matrix containing the formatted object.

Author(s)

Andreas Alfons

Examples

1
2
3
# note how numbers in the interval (-1, 1) are printed
# without the zero in front of the comma
formatSPSS(c(-1.5, -2/3, 2/3, 1.5))

r2spss documentation built on Nov. 25, 2021, 1:06 a.m.