Learn R Programming

bioimagetools (version 1.1.9)

table.n: Cross Tabulation and Table Creation (including empty classes)

Description

Cross Tabulation and Table Creation (including empty classes)

Usage

table.n(
  x,
  m = max(x, na.rm = TRUE),
  percentage = FALSE,
  weight = NULL,
  parallel = FALSE
)

Value

vector with (weighted) counts (including empty classes)

Arguments

x

R object with classes

m

maximum number of classes

percentage

boolean. If TRUE result is in percentages.

weight

weight for each voxel

parallel

Logical. Can we use parallel computing?

Author

Volker Schmid 2013-2016

Examples

Run this code
x <- c(1,1,2,2,4,4,4)
table.n(x)
# [1] 2 2 0 3
table.n(x, m=5)
# [1] 2 2 0 3 0
table.n(x, weight=c(1,1,1,2,.5,.5,.5))
# [1] 2.0 3.0 0.0 1.5

Run the code above in your browser using DataLab