Learn R Programming

akmedoids (version 1.3.0)

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

Description

This function converts counts or rates to proportions.

Usage

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.

Value

A dataframe 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 {
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)

# }

Run the code above in your browser using DataLab