The purpose of this package is to share a collection of functions the
author wrote during weekends for managing kitchen and garden tasks,
e.g. making plant growth charts or Thanksgiving kitchen schedule charts,
etc. Functions may include but are not limited to: (1) aiding in
summarizing time-related data; (2) generating axis transformations from
data; and (3) aiding Markdown (with HTML output) and Shiny file
editing.
You can install the latest version of mtb like so:
install.packages('mtb')
You can install the development version of mtb like so:
devtools::install_github('yh202109/mtb',ref='main')
This is a basic example which shows you how to automatically select colors for individual groups by 3 major colors, blue, cyan and orange. The first argument represents group values. The second argument specify the order of $a$ to $g$, the third argument specifies that group $a$ is assigned to the black color, and group $b$ is assigned to the gray color.
library(mtb)
colvect = color_set_palette(c('a','b','d','c','e','f','g'), c(1,2,4,3,5,6,7),black='a',gray9='b',cols=c('blue', 'cyan','orange'))
This is a basic example which shows you how to quickly test selected colors:
color_test_palette(colvect, type='line')

color_test_palette(colvect, type='bar')

This is a basic example which shows you how to format a string:
add_colored_str('Example - Warning', color=c(255,0,0), bold=TRUE, fontsize=1.5)
Example - Warning
This is an example which shows you how to add a default box:
add_colored_box(info='additional information')
This is an example which shows you how to add a warning box:
add_colored_box(type='yellow-warning', info='Here is the warning message.')
This is a basic example which shows you how to generate a crosstab from a data frame with row-wise percentages:
df <- data.frame(
A = c('foo','foo','foo','foo','foo','foo','bar','bar','baz','baz','baz'),
D = c('apple','apple','apple','apple','banana','apple','banana','apple','banana','apple','banana'),
E = c('red','blue','red','red','red','blue','blue','red','blue','red','blue')
)
result <- crosstab_from_list(df, rows=c("A"), cols=c("D","E"),
perct_within_index="A", report_type=1)
result$report
#> A apple | blue banana | blue apple | red banana | red All
#> 1 bar 0 (0%) 1 (50%) 1 (50%) 0 (0%) 2 (100%)
#> 2 baz 0 (0%) 2 (66.7%) 1 (33.3%) 0 (0%) 3 (100%)
#> 3 foo 2 (33.3%) 0 (0%) 3 (50%) 1 (16.7%) 6 (100%)
#> 4 All 2 (18.2%) 3 (27.3%) 5 (45.5%) 1 (9.1%) 11 (100%)
Beginning with version 0.1.10, selected components of this package — including certain vignettes, Shiny applications, and supporting documentation — are developed with the assistance of an AI coding tool (Posit Assistant) under direct human direction.
The following principles govern AI-assisted work in this package: