Learn R Programming

akmedoids (version 0.1.1)

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

Description

This function converts counts or rates to proportions.

Usage

props(traj, id_field = TRUE)

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 recognises the second column as the first time step.

Value

A matrix of proportion measures

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]

Examples

Run this code
# NOT RUN {
traj <- traj
head(traj) #
traj <- dataImputation(traj, id_field = TRUE, method = 2, replace_with = 1,
fill_zeros = FALSE) #filling the missing values
traj <- props(traj, id_field = TRUE)
print(traj)
# }

Run the code above in your browser using DataLab