convert_to_percentage: convert_to_percentage

View source: R/convert_to_percentage.R

convert_to_percentageR Documentation

convert_to_percentage

Description

convert_to_percentage can convert a data frame to percentage.

Usage

convert_to_percentage(df, row_sum = TRUE, hundred_percent = FALSE)

Arguments

df

A data frame.

row_sum

Default is TRUE. If row_sum == TRUE, then will take every value of a row and divide by the summary of this row, and apply this to every row. If row_sum == FALSE, then will take every value of a column and divide by the summary of this column, and apply this to every column. Total sum of the result is 1.

hundred_percent

Default is FALSE, if TRUE, turn value to 100 percent, total sum is 100.

Examples

convert_to_percentage(demo_dada2_result$seq_tab, row_sum = TRUE) %>% .[,1:5]

yeguanhuav/visualization416S documentation built on March 22, 2022, 9:03 p.m.