props: Conversion of counts (or rates) to 'Proportion'

Description Usage Arguments Details Value Examples

View source: R/props.R

Description

This function converts counts or rates to proportions.

Usage

1
props(traj, id_field = TRUE, scale = 1, digits = 4)

Arguments

traj

[matrix (numeric)]: longitudinal data. Each row represents an individual trajectory (of observations). The columns show the observations at consecutive time points.

id_field

[numeric or character] Whether the first column of the traj is a unique (id) field. Default: FALSE. If TRUE the function recognizes the second column as the first time step.

scale

[numeric] To scale the 'proportion' measures. Default: 1

digits

[numeric] Specifying number of digits to approximate the output to. Default: 4.

Details

Given a matrix of observations (counts or rates), this function converts each observation to a proportion equivalent to the sum of each column. In other words, each observation is divided by the sum of the column where it is located, i.e. prop = [a cell value] / sum[corresponding column]

Value

A dataframe of proportion measures

Examples

1
2
3
4
5
6
7
trajectry <- data_imputation(traj, id_field = TRUE, method = 2,
replace_with = 1, fill_zeros = FALSE) #filling the missing values

trajectry <- props(trajectry$CompleteData, id_field = TRUE,
scale=1, digits=4)

print(trajectry)

akmedoids documentation built on April 13, 2021, 9:07 a.m.