File: formatA.R

package info (click to toggle)
r-cran-blockmodeling 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 912 kB
  • sloc: ansic: 2,024; f90: 952; sh: 13; makefile: 5
file content (30 lines) | stat: -rw-r--r-- 895 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#' @encoding UTF-8
#' @title A formating function for numbers
#' 
#' @description
#' Formats a vector or matrix of numbers so that all have equal length (digits). This is especially suitable for printing tables.
#'
# #' @usage formatA(x, digits = 2, FUN = round, ...)
#' 
#' @param x A numerical vector or matrix.
#' @param digits The number of desired digits.
#' @param FUN Function used for "shortening" the numbers.
#' @param \dots Additional arguments to \code{format}.
#'
#' @return A character vector or matrix.
#'
#' @examples
#' A <- matrix(c(1, 1.02002, 0.2, 10.3), ncol = 2)
#' formatA(A)
#' 
#' @author \enc{Aleš Žiberna}{Ales Ziberna}
#' @seealso \code{\link{find.m}}, \code{\link{find.m2}}, \code{\link{find.cut}}
#' @keywords character
#' 
#' @export

"formatA" <-
function(x,digits=2, FUN=round,...){
	noquote(format(FUN(x, digits=digits),...))
}