Learn R Programming

dataMojo (version 1.0.0)

row_percent_convert: Convert count to percentage

Description

Convert count to percentage

Usage

row_percent_convert(data, cols_rowsum)

Value

data frame with calculated row percentage

Arguments

data

data frame

cols_rowsum

columns need to be converted to percentage

Examples

Run this code
test_df <- data.frame(
  Group = c("A", "B", "C"),
  Female = c(2,3,5),
  Male = c(10,11, 13)
)
dataMojo::row_percent_convert(test_df, cols_rowsum = c("Female", "Male"))

Run the code above in your browser using DataLab