Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

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

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

Anchored Kmedoids for Longitudinal Data Clustering

v1.3.0
GPL-3
Authors
Monsuru Adepeju [cre, aut], Samuel Langton [aut], Jon Bannister [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.