Category Table
category_table( marks, cols, cats = NULL, symbol = "✔", kable = TRUE, critwidth = 0.5, ... )
marks | table with criteria columns (only the first row will be used) |
---|---|
cols | a named vector of the criteria (names are the marks column names and values are the text to display) |
cats | a named vector of the marking categories (names are the value in marks and values are the text to display) |
symbol | the symbol to display in the table (✔ is the HTML code for a check mark) |
kable | return kable (T) or data table (F) |
critwidth | the width of the first (criteria) column; the rest of the columns are set to equal widths |
... | arguments to pass to kableExtra |
a kable table or a data table
marks <- data.frame(ID = 7, K = 1, E = 2, C = 3) cols <- c(K = "Knowledge", E = "Evaluation", C = "Communication") cats <- c("1" = "Bad", "2" = "OK", "3" = "Good") category_table(marks, cols, cats) # html table#> <table class="table" style="margin-left: auto; margin-right: auto;"> #> <thead> #> <tr> #> <th style="text-align:left;"> Criteria </th> #> <th style="text-align:center;"> Bad </th> #> <th style="text-align:center;"> OK </th> #> <th style="text-align:center;"> Good </th> #> </tr> #> </thead> #> <tbody> #> <tr> #> <td style="text-align:left;width: 52%; "> Knowledge </td> #> <td style="text-align:center;width: 16%; "> ✔ </td> #> <td style="text-align:center;width: 16%; "> </td> #> <td style="text-align:center;width: 16%; "> </td> #> </tr> #> <tr> #> <td style="text-align:left;width: 52%; "> Evaluation </td> #> <td style="text-align:center;width: 16%; "> </td> #> <td style="text-align:center;width: 16%; "> ✔ </td> #> <td style="text-align:center;width: 16%; "> </td> #> </tr> #> <tr> #> <td style="text-align:left;width: 52%; "> Communication </td> #> <td style="text-align:center;width: 16%; "> </td> #> <td style="text-align:center;width: 16%; "> </td> #> <td style="text-align:center;width: 16%; "> ✔ </td> #> </tr> #> </tbody> #> </table>category_table(marks, cols, cats, "X", FALSE) # data table#> Criteria Bad OK Good #> 1 Knowledge X #> 2 Evaluation X #> 3 Communication X