Learn R Programming

smallstuff (version 1.0.3)

withinPC: Calculate Row or Column Percentages

Description

Calculate percentages of values in a matrix or table with respect to the row or column totals.

Usage

withinPC(X, rows = TRUE, rnd = 1)

Value

A matrix or table with percentages

Arguments

X

matrix or table

rows

TRUE (default) to calculate by rows, or FALSE to calculate by columns

rnd

numbers of digits to round the result to

Examples

Run this code
(X=matrix(c(1:12),3))
withinPC(X)

Run the code above in your browser using DataLab