| Title: | Supplies essential functions to Teaching Lab dashboards |
|---|---|
| Description: | A bunch of random functions I use in developing dashboards Needs to vastly reduce the number of dependencies at the moment. |
| Authors: | Duncan Gates |
| Maintainer: | Duncan Gates <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.2 |
| Built: | 2026-11-23 09:54:14 UTC |
| Source: | https://github.com/TeachingLabHQ/tlShiny |
Column groups used in FSOT scoring for Aligned Content (AC), Assessment & Differentiation (AD), Student Practice (SP), and Teacher-Directed Instruction (TD).
ac_colsac_cols
An object of class character of length 2.
Six brand blues from black to #00ACF0 for the agreement scale, plus the text colour readable on each.
agree_scale_colors( wrap = FALSE, scale_levels = agree_scale_levels(wrap = wrap), type = c("fill", "text") )agree_scale_colors( wrap = FALSE, scale_levels = agree_scale_levels(wrap = wrap), type = c("fill", "text") )
wrap |
whether to name the colours with the two line labels |
scale_levels |
the labels to name the colours with |
type |
"fill" for bar colours or "text" for label colours |
a named character vector of hex colours
The FY27 6 point agreement scale labels in order.
agree_scale_levels(wrap = FALSE)agree_scale_levels(wrap = FALSE)
wrap |
whether to break the long labels over two lines for plot legends |
a character vector of length 6
Gets the percent that agree and strongly agree
agree_strongly_agree(data, question)agree_strongly_agree(data, question)
data |
the data |
question |
a string - the question to get the percentage for |
a string
## Not run: plot_agree |> agree_strongly_agree(question = "x") ## End(Not run)## Not run: plot_agree |> agree_strongly_agree(question = "x") ## End(Not run)
Relabels Likert responses onto the 6 point agreement scale by their leading integer, discarding whatever words Qualtrics exported. Responses collected on the 5 point scale keep their integer, so a historical "3 - Neither agree nor disagree" becomes "3 - Somewhat Disagree".
as_agree_scale(x, wrap = FALSE, scale_levels = agree_scale_levels(wrap = wrap))as_agree_scale(x, wrap = FALSE, scale_levels = agree_scale_levels(wrap = wrap))
x |
a vector of Likert responses |
wrap |
whether to use the two line labels from agree_scale_levels() |
scale_levels |
the ordered labels to map scores 1..n onto |
a factor with all scale levels present
as_agree_scale(c("3 - Neither agree nor disagree", "6 - Strongly Agree"))as_agree_scale(c("3 - Neither agree nor disagree", "6 - Strongly Agree"))
Convenience vectors grouping IPG rubric items by Core Action (CA1, CA2, CA3) for scoring. These include both character and numeric columns.
ca1_colsca1_cols
An object of class character of length 15.
Calculate nps score
calc_nps(x)calc_nps(x)
x |
A vector of nps scores |
Returns the nps score With formula '
Verifies that an email is in a list
check_email_approved(email, approved_emails_list)check_email_approved(email, approved_emails_list)
email |
the email provided |
approved_emails_list |
the email to check the list for |
TRUE or FALSE
Verifies that an email is of a specified domain
check_email_domain(email, domain)check_email_domain(email, domain)
email |
the email provided |
domain |
the domain to check that it is from |
TRUE or FALSE
Returns a barchart for selections in the relevant questions of the contact lead survey
contact_lead_graph(data)contact_lead_graph(data)
data |
the data to use |
prints a ggplot object
Returns a barchart for selections in the relevant questions of the end of coaching survey
course_feedback_graph(data)course_feedback_graph(data)
data |
the data to use |
prints a ggplot object
Efficiently filters data frame by two dates (inclusive), for use in shiny apps
date_filter(data, date1, date2, dat_filter)date_filter(data, date1, date2, dat_filter)
data |
the dataframe to apply filter to |
date1 |
the min date |
date2 |
the max date |
dat_filter |
Data column object to filter |
filtered data.frame
Creates a button that will expand or hide content
drop1(before = T, options, envir, name)drop1(before = T, options, envir, name)
before |
button default, collapsed/not collapsed |
options |
unclear |
envir |
also unclear |
name |
chunk name |
html wrapper
Returns a barchart for selections in the relevant questions of the end of coaching survey
end_coaching_feedback_graph(data)end_coaching_feedback_graph(data)
data |
the data to use |
prints a ggplot object
Gives the file path without double slash bug
file.path2(..., fsep = .Platform$file.sep)file.path2(..., fsep = .Platform$file.sep)
... |
The file path |
fsep |
the file separation |
fp a file path
Uses column names and finds the percent in each attributed to positive answers (or negative if reverse coded), summarises by prepost
get_percent_positive_student_survey(data)get_percent_positive_student_survey(data)
data |
the data to use |
a tibble
function for grading different parts of the ipg forms
grade_ipg(x, type = "character")grade_ipg(x, type = "character")
x |
the data |
type |
character or numeric |
a percentage of correct either by checking 3 or 4 or yes
makes a gt table with percent and n colored
gt_percent_n( df, column, custom_title, no_title = T, base_font = 10, heading_font = 14, custom_column_name = "", viz_type = "gt" )gt_percent_n( df, column, custom_title, no_title = T, base_font = 10, heading_font = 14, custom_column_name = "", viz_type = "gt" )
df |
the data frame |
column |
the column to get count and percent from |
custom_title |
the title for the table |
no_title |
make the table have no title |
base_font |
overall table font size |
heading_font |
title font size |
custom_column_name |
a custom name for the column |
viz_type |
gt by default, also has ggplot options like pie chart, waffle, or treemap |
a gt table
Create Teaching Lab theme to a gt table
gt_theme_tl( data, all_caps = F, align = "center", base_font = 16, heading_font = 20, ... )gt_theme_tl( data, all_caps = F, align = "center", base_font = 16, heading_font = 20, ... )
data |
An existing gt table object |
all_caps |
Whether or not to capitalize titles |
align |
Align options are "left", "center", "right" |
base_font |
the font size |
heading_font |
the title font size |
... |
Optional additional arguments to gt::table_options() |
Creates a gt theme as a pipeable function
mtcars |> utils::head() |> gt::gt() |> tlShiny::gt_theme_tl()mtcars |> utils::head() |> gt::gt() |> tlShiny::gt_theme_tl()
Helper function to extract a grob from gtables by name.
gtable_extract_grob(g, pattern = "guide-box")gtable_extract_grob(g, pattern = "guide-box")
g |
the gtable to extract the grob |
pattern |
grob name or pattern to match |
g, a grob matching the specified pattern
Helper function to remove grobs by name, from gtables
gtable_remove_grob(g, pattern = "guide-box")gtable_remove_grob(g, pattern = "guide-box")
g |
gtable with the grob removed |
pattern |
grob name or pattern to match |
g, with pattern removed.
Provides html formatted highlighting
highlight_fun(data, highlight = tlShiny::find_highlight(data))highlight_fun(data, highlight = tlShiny::find_highlight(data))
data |
the data to highlight |
highlight |
the words to highlight |
#' @title Word highlighting #' @description Finds most common words in string #' @param string the string to evaluate #' @param n the number of words to find #' @param print whether or not to print the highlighted words #' @return a vector of strings #' #' @export find_highlight <- function(string, n = 3, print = F) stop_words <- tlShiny::stop_words |> dplyr::bind_rows(data.frame(word = tlShiny::na_df, lexicon = "TL_NA"))
txt_df <- data.frame(column_name = "txt") |>
highlight <- string |> na.omit() |> as.data.frame() |> dplyr::rename() |> tidytext::unnest_tokens(word, txt) |> # This makes sure to get rid of numbers in consideration for highlighting # By making sure as.numeric returns NA on words dplyr::filter(is.na(as.numeric(word))) |> # Get a count of words and sort dplyr::count(word, sort = T) |> # Get rid of generic (stop) words dplyr::anti_join(stop_words) |> # Get a user-specified number of words, or the default 3 utils::head(n) |> # Make this a vector dplyr::pull(word) |> # Suppress warnings from the as.numeric call suppressWarnings() |> suppressMessages()
if (print == T) print(highlight)
return(highlight)
a vector of strings
Takes a string and inserts <br> at the requested intervals
html_wrap(string, n = 40)html_wrap(string, n = 40)
string |
the string |
n |
the width of the string before a <br> tag |
the same string with <br> inserted at the requested interval
html_wrap("a random string that has about 40 characters in it")html_wrap("a random string that has about 40 characters in it")
Creates a column chart of overall IPG scores by observation timepoint ('direct_to_ts_obs'), using the
"Overall" row from ipg_summarise_overall and annotating bars with percent and sample size (n).
ipg_bar_chart(data)ipg_bar_chart(data)
data |
Long-format data from |
A ggplot object.
teacher_scores <- ipg_summarise_teacher(ipg_data) overall_long <- ipg_summarise_overall(teacher_scores) ipg_bar_chart(overall_long)teacher_scores <- ipg_summarise_teacher(ipg_data) overall_long <- ipg_summarise_overall(teacher_scores) ipg_bar_chart(overall_long)
Character column names from the Instructional Practice Guide (IPG) rubric. These are typically binary values like "Yes"/"No" indicating presence of a practice.
ipg_character_colsipg_character_cols
An object of class character of length 9.
Numeric column names from the IPG rubric, scored from 1 to 4. Higher scores indicate stronger alignment with the rubric.
ipg_numeric_colsipg_numeric_cols
An object of class character of length 59.
Numeric columns from the IPG rubric with a lower scale where 2 and 3 are considered "high."
ipg_numeric_low_colsipg_numeric_low_cols
An object of class character of length 2.
Plots domain-level IPG scores (CA1–CA3, AC, AD, SP, TDI, and Overall) with facets by
observation timepoint. Labels bars with percent and sample size (n). Uses tlShiny::tl_palette
for fills and abbreviates domain labels in the plot.
ipg_rubric_chart(data, rubric, colors)ipg_rubric_chart(data, rubric, colors)
data |
Long-format data from |
rubric |
Character string used in the plot title (e.g., rubric name shown to users). |
colors |
Integer for the number of colors to request from |
A ggplot object.
teacher_scores <- ipg_summarise_teacher(ipg_data) overall_long <- ipg_summarise_overall(teacher_scores) ipg_rubric_chart(overall_long, rubric = "Math IPG", colors = 8)teacher_scores <- ipg_summarise_teacher(ipg_data) overall_long <- ipg_summarise_overall(teacher_scores) ipg_rubric_chart(overall_long, rubric = "Math IPG", colors = 8)
Aggregates teacher-level IPG scores by observation timepoint ('direct_to_ts_obs') and reshapes to long format with scores and Ns. Includes core actions and FSOT domain scores.
ipg_summarise_overall(data)ipg_summarise_overall(data)
data |
Output from |
A long-format data frame with columns: direct_to_ts_obs, Core Action, Score, n.
teacher_scores <- ipg_summarise_teacher(ipg_data) ipg_summarise_overall(teacher_scores)teacher_scores <- ipg_summarise_teacher(ipg_data) ipg_summarise_overall(teacher_scores)
Converts raw IPG rubric responses to logical scores and computes summary scores by core action and domain.
ipg_summarise_teacher( df, character_cols = ipg_character_cols, numeric_cols = ipg_numeric_cols, numeric_low_cols = ipg_numeric_low_cols )ipg_summarise_teacher( df, character_cols = ipg_character_cols, numeric_cols = ipg_numeric_cols, numeric_low_cols = ipg_numeric_low_cols )
df |
A data frame with raw IPG rubric columns and metadata (e.g., 'direct_to_ts_obs', 'ipg_rubric'). |
ipg_character_cols |
character columns |
ipg_numeric_cols |
numeric columns |
ipg_numeric_low_cols |
numeric columns with low score range |
A data frame of teacher-level scores, one row per observation.
ipg_summarise_teacher(ipg_data)ipg_summarise_teacher(ipg_data)
Creates a graph specifically for Knowledge Assessments in mid year reports
know_assess_summary(data, know_assess_filter)know_assess_summary(data, know_assess_filter)
data |
the data |
know_assess_filter |
the knowledge assessment to make plot for |
a ggplot
Creates a graph specifically for Knowledge Assessments Scored by Question from Qualtrics
know_assess_summary_detailed(data, know_assess)know_assess_summary_detailed(data, know_assess)
data |
the data |
know_assess |
the knowledge assessment to make plot for |
a ggplot
Extracts the leading integer from a Qualtrics Likert label, e.g. "4 - Somewhat Agree" -> 4. Numeric input is returned as integer.
likert_score(x)likert_score(x)
x |
a character, factor, or numeric vector of Likert responses |
an integer vector, NA where no leading integer is present
likert_score(c("1 - Strongly disagree", "5 - Agree", NA))likert_score(c("1 - Strongly disagree", "5 - Agree", NA))
Creates a chart to summarise the ELA IPG based on the round selected
make_ipg_ela_summary_chart( data, round = "Baseline (first observation of the year)" )make_ipg_ela_summary_chart( data, round = "Baseline (first observation of the year)" )
data |
the data |
round |
the round of the IPG for which data should be pulled (can be one of "Baseline (first observation of the year)", "Mid-year (middle of service, if applicable)", "End of year (last observation of the year)", "Other", or "Ongoing") |
a ggplot
Creates a chart to summarise the FSOT IPG based on the round selected
make_ipg_fsot_summary_chart( data, round = "Baseline (first observation of the year)" )make_ipg_fsot_summary_chart( data, round = "Baseline (first observation of the year)" )
data |
the data |
round |
the round of the IPG for which data should be pulled (can be one of "Baseline (first observation of the year)", "Mid-year (middle of service, if applicable)", "End of year (last observation of the year)", "Other", or "Ongoing") |
a ggplot
Creates a chart to summarise the Math IPG based on the round selected
make_ipg_math_summary_chart( data, round = "Baseline (first observation of the year)" )make_ipg_math_summary_chart( data, round = "Baseline (first observation of the year)" )
data |
the data |
round |
the round of the IPG for which data should be pulled (can be one of "Baseline (first observation of the year)", "Mid-year (middle of service, if applicable)", "End of year (last observation of the year)", "Other", or "Ongoing") |
a ggplot
Chart to show the
make_student_work_chart_circle(data)make_student_work_chart_circle(data)
data |
the data for the plotter to use, should include all columns of interest |
a ggplot
Chart to show the
make_student_work_chart_people(data)make_student_work_chart_people(data)
data |
the data for the plotter to use, should include all columns of interest |
a ggplot
Creates a chart to summarise the teacher perceptions of curriculum
make_teacher_curriculum_perceptions(data)make_teacher_curriculum_perceptions(data)
data |
the data |
a ggplot
Creates a chart to summarise the Teacher Curriculum Usage from the Educator Survey
make_teacher_curriculum_usage(data)make_teacher_curriculum_usage(data)
data |
the data |
a ggplot
Creates a chart to summarise the teacher use of lessons from district or school-adopted materials
make_teacher_lesson_usage(data)make_teacher_lesson_usage(data)
data |
the data |
a ggplot
Creates a chart to summarise the teacher perceptions of of peer relationships
make_teacher_perceptions_peer_relationships(data)make_teacher_perceptions_peer_relationships(data)
data |
the data |
a ggplot
Creates a chart to summarise the teacher perceptions of school leaders
make_teacher_perceptions_school_leaders(data)make_teacher_perceptions_school_leaders(data)
data |
the data |
a ggplot
A list of NA type words to ignore in qualitative responses
na_dfna_df
A character vector
Conditionally filters value given that it is not the first parameter, for use in shiny apps
neg_cond_filter(data, filter_this, dat_filter, multi_value = FALSE)neg_cond_filter(data, filter_this, dat_filter, multi_value = FALSE)
data |
the dataframe to apply filter |
filter_this |
Filter for this, only filters if length >= 1 |
dat_filter |
Data column object to filter |
multi_value |
If TRUE, values like "ELA/Literacy, Math" are split on ", " and the row is kept when any piece matches 'filter_this' |
filtered data.frame
Converts a character-based rubric score into a logical value indicating proficiency. Supports three types: '"character"' (Yes/No), '"numeric"' (1–4 scale), and '"numeric_low"' (1–3 scale).
new_grade_ipg(x, type)new_grade_ipg(x, type)
x |
A character vector of rubric values. |
type |
One of '"character"', '"numeric"', or '"numeric_low"' determining the rubric logic. |
A logical vector with TRUE (proficient), FALSE (not proficient), or NA.
A plot that says no data available yet this year
no_data_plot_currentlyno_data_plot_currently
An object of class ggplot2::ggplot (inherits from ggplot, ggplot2::gg, S7_object, gg) of length 1.
A plot that says no data available by default, but can be adjusted to say whatever you want
no_data_plot_custom(title = "No data available!")no_data_plot_custom(title = "No data available!")
A plot that says no data available, and to check your filters
no_data_plot_filtersno_data_plot_filters
An object of class ggplot2::ggplot (inherits from ggplot, ggplot2::gg, S7_object, gg) of length 1.
Find elements x not in a vector y
x %!in% yx %!in% y
x |
A vector of what shouldn't exist |
y |
A vector to check against |
Returns elements not in vector
Returns a barchart for selections in the relevant questions of the end of coaching survey
ongoing_coaching_feedback_graph(data)ongoing_coaching_feedback_graph(data)
data |
the data to use |
prints a ggplot object
Percent of non-missing responses scoring at or above a threshold. The default of 4 selects Agree/Strongly agree on the 5 point scale and Somewhat Agree/Agree/Strongly Agree on the 6 point scale, so it gives the same answer on historical data under both.
pct_agree(x, threshold = 4)pct_agree(x, threshold = 4)
x |
a vector of Likert responses |
threshold |
the lowest score counted as agreement |
a single percentage between 0 and 100, NA when there are no responses
pct_agree(c("4 - Agree", "5 - Strongly agree", "2 - Disagree", NA))pct_agree(c("4 - Agree", "5 - Strongly agree", "2 - Disagree", NA))
Posts to the capture endpoint later, off the current reactive flush, so a slow or failing request never holds up the session. Failures are warnings.
posthog_capture( event, distinct_id, app, properties = list(), timestamp = Sys.time(), force = FALSE )posthog_capture( event, distinct_id, app, properties = list(), timestamp = Sys.time(), force = FALSE )
event |
Event name, e.g. "dashboard_opened" |
distinct_id |
The person, normally their email |
app |
App name stored in the 'app' property |
properties |
Named list of extra properties |
timestamp |
POSIXct time of the event, defaults to now |
force |
Send even outside Connect (see [posthog_enabled()]) |
NULL, invisibly
TRUE on Posit Connect ('RSTUDIO_PRODUCT' is 'CONNECT') when 'POSTHOG_PROJECT_KEY' is set. 'force = TRUE' skips the Connect check, for testing a local run against PostHog.
posthog_enabled(force = FALSE)posthog_enabled(force = FALSE)
force |
Track outside Connect too |
Logical
Convenience vector combining all PreK rubric items (Language + Literacy).
prek_colsprek_cols
An object of class character of length 19.
Character column names from the PreK rubric for Language. Values are Likert-type, with "Always" and "Often" treated as proficient.
prek_lang_colsprek_lang_cols
An object of class character of length 10.
Character column names from the PreK rubric for Literacy. Values are Likert-type, with "Always" and "Often" treated as proficient.
prek_lit_colsprek_lit_cols
An object of class character of length 9.
Aggregates teacher-level PreK scores by observation timepoint ('direct_to_ts_obs') and reshapes to long format with Scores and Ns. Domains: Language, Literacy, Overall.
prek_summarise_overall(data)prek_summarise_overall(data)
data |
Output from |
A long-format data frame with columns: direct_to_ts_obs, Domain, Score, n.
Converts raw PreK rubric responses to logical scores and computes language, literacy, and overall scores (percent proficient) per observation.
prek_summarise_teacher( df, prek_lang_cols = prek_lang_cols, prek_lit_cols = prek_lit_cols )prek_summarise_teacher( df, prek_lang_cols = prek_lang_cols, prek_lit_cols = prek_lit_cols )
df |
A data frame with PreK rubric columns plus 'direct_to_ts_obs', 'ipg_rubric'. |
prek_lang_cols |
Language item columns. |
prek_lit_cols |
Literacy item columns. |
A data frame with one row per observation.
takes a dataframe and makes a gt table or ggplot that shows a quote
quote_viz( data, text_col = colnames(data)[1], viz_type = "gt", custom_highlight = NULL, n = 3, print = T, width = 60, title = NULL, suppress_warnings = T, align = "center", save = T, ... )quote_viz( data, text_col = colnames(data)[1], viz_type = "gt", custom_highlight = NULL, n = 3, print = T, width = 60, title = NULL, suppress_warnings = T, align = "center", save = T, ... )
data |
the dataframe |
text_col |
columns to create table for |
viz_type |
ggplot or gt visualization |
custom_highlight |
a vector, optional custom highlighting |
n |
integer, number of words to auto-highlight |
print |
T, whether or not to print the highlighted words to console |
width |
The width of the table generated |
title |
the title of the ggplot or gt |
suppress_warnings |
T/F suppression of warnings |
align |
the table alignment: "left", "center", "right" |
... |
Arguments passed onto the gt table |
a ggplot/gt that visualizes text
## Not run: df <- tlShiny::survey_monkey colnames(df)[1] <- "What learning are you excited to try?" quote_viz( data = df, text_col = "What learning are you excited to try?", viz_type = "gt", title = "Responses from Survey Monkey" ) ## End(Not run)## Not run: df <- tlShiny::survey_monkey colnames(df)[1] <- "What learning are you excited to try?" quote_viz( data = df, text_col = "What learning are you excited to try?", viz_type = "gt", title = "Responses from Survey Monkey" ) ## End(Not run)
Filters out all rows that contain entirely NA
remove_empty_tl(data)remove_empty_tl(data)
data |
the dataframe to apply filter |
a dataframe with no empty rows
The FY27 6 point satisfaction scale labels in order.
satisfaction_scale_levels(wrap = FALSE)satisfaction_scale_levels(wrap = FALSE)
wrap |
whether to break the long labels over two lines for plot legends |
a character vector of length 6
See tl_palette().
scale_colour_tl(n, color = "blue", ...) scale_color_tl(n, color = "blue", ...) scale_fill_tl( n, color = c("blue", "orange", "purple", "green", "teal", "tl_colors"), ... )scale_colour_tl(n, color = "blue", ...) scale_color_tl(n, color = "blue", ...) scale_fill_tl( n, color = c("blue", "orange", "purple", "green", "teal", "tl_colors"), ... )
n |
the number of colors |
color |
the color from |
... |
Arguments passed on to
|
Returns a barchart for selections in the relevant questions of the end of coaching survey
session_feedback_graph(data)session_feedback_graph(data)
data |
the data to use |
prints a ggplot object
This function computes the square of a numeric input.
square(x)square(x)
x |
A numeric input. |
The square of the input.
tlShiny::square(2) tlShiny::square(3.5)tlShiny::square(2) tlShiny::square(3.5)
English stop words from three lexicons, as a data frame. The snowball and SMART sets are pulled from the tm package. Note that words with non-ASCII characters have been removed.
stop_wordsstop_words
A data frame with 1149 rows and 2 variables:
An English word
The source of the stop word. Either "onix", "SMART", or "snowball"
Automatically dodged bar chart for student data
student_bar_chart( data, col_select, agree_select, string_remove, title, legend_position = c(0.8, 0.25) )student_bar_chart( data, col_select, agree_select, string_remove, title, legend_position = c(0.8, 0.25) )
data |
the data for the plotter to use, should include all columns of interest |
col_select |
the columns to select with 'tidyselect::contains' |
agree_select |
the type of agree/strongly agree to select, for example also often/always |
string_remove |
NULL by default, provides an optional string removal |
title |
the title for the plot |
legend_position |
c(0.8, 0.25) by default, adjustable |
a ggplot object
Survey monkey reviews from the course survey in response to the question What is the learning from this course that you are most excited about trying out?, as a data frame.
survey_monkeysurvey_monkey
A data frame with 87 rows and 1 variable:
A deidentified review in each row
@source https://www.surveymonkey.com/r/TLendofcourse
Teaching Lab Custom Ggplot2 Theme
theme_tl( base_family = "Lora", base_size = 14, strip_text_family = base_family, strip_text_size = 15, plot_title_family = "Poppins", plot_title_size = 20, plot_title_margin = 10, subtitle_family = "Lora", subtitle_size = 15, subtitle_margin = 15, caption_family = "Lora", caption_size = 11, caption_margin = 10, axis_title_family = "Poppins", axis_title_size = 12, axis_title_just = "mm", axis_text_size = 10.5, dark = FALSE, grid = TRUE, axis = FALSE, ticks = FALSE, markdown = FALSE, legend = F )theme_tl( base_family = "Lora", base_size = 14, strip_text_family = base_family, strip_text_size = 15, plot_title_family = "Poppins", plot_title_size = 20, plot_title_margin = 10, subtitle_family = "Lora", subtitle_size = 15, subtitle_margin = 15, caption_family = "Lora", caption_size = 11, caption_margin = 10, axis_title_family = "Poppins", axis_title_size = 12, axis_title_just = "mm", axis_text_size = 10.5, dark = FALSE, grid = TRUE, axis = FALSE, ticks = FALSE, markdown = FALSE, legend = F )
base_family |
base font family |
base_size |
base font size |
strip_text_family |
facet label font family |
strip_text_size |
facet label text size |
plot_title_family |
plot title family |
plot_title_size |
plot title font size |
plot_title_margin |
plot title margin |
subtitle_family |
plot subtitle family |
subtitle_size |
plot subtitle size |
subtitle_margin |
plot subtitle margin |
caption_family |
plot caption family |
caption_size |
plot caption size |
caption_margin |
plot caption margin |
axis_title_family |
axis title font family |
axis_title_size |
axis title font size |
axis_title_just |
axis title font justification |
axis_text_size |
axis text size |
dark |
dark mode |
grid |
panel grid ( |
axis |
axis |
ticks |
ticks |
markdown |
enabled ggtext markdown styling |
legend |
default no legend with F |
It requires installing Poppins, Lora fonts unless you change the font parameters
TL Default Blue Palette
tl_pal_bluetl_pal_blue
An object of class character of length 8.
Teaching Lab Color Palette Maker
tl_palette( color = c("blue", "orange", "purple", "green", "teal", "tl_colors"), theme = c("dark"), n = 6, base_color_start = NULL )tl_palette( color = c("blue", "orange", "purple", "green", "teal", "tl_colors"), theme = c("dark"), n = 6, base_color_start = NULL )
color |
the color palette to generate |
theme |
if theme is light or dark |
n |
number of colors to generate |
base_color_start |
the base color of the palette to start with, ramping towards the color option |
color ramp palette function
Teaching Lab Color Palette Maker
tl_palette2(n = 6, base_color_start = NULL, end_color_start = NULL)tl_palette2(n = 6, base_color_start = NULL, end_color_start = NULL)
n |
number of colors to generate |
base_color_start |
the base color of the palette to start with, ramping from the color option |
base_color_end |
the base color of the palette to end with, ramping towards the color option |
color ramp palette function
Automatically scaled stacked bar chart with TL theming
tl_select_percent(data, percent_equal)tl_select_percent(data, percent_equal)
data |
the data for the plotter to use, should include all columns of interest |
percent_equal |
string inputs to find the percent of the column that equals those values |
a percentage as a string
Call once at the top of the server function. Once 'user_email()' returns an email it logs 'dashboard_opened', loads PostHog in the browser already identified as that email, and on session end logs 'dashboard_closed' with 'minutes'. Input changes are sent from the browser as 'input_changed' ('tab_input' changes as 'tab_viewed'), debounced so a multi-select that changes several times in a second sends one event.
track_usage( session, app, user_email = function() session$user, tracked_inputs = NULL, tab_input = NULL, surveys = TRUE, force = FALSE )track_usage( session, app, user_email = function() session$user, tracked_inputs = NULL, tab_input = NULL, surveys = TRUE, force = FALSE )
session |
The Shiny session |
app |
App name, e.g. "ongoing_report" |
user_email |
A reactive or function returning the viewer's email. Defaults to 'session$user' (the Connect login). 'NULL' for an app with no sign-in: the session is tracked anonymously from the start |
tracked_inputs |
Input ids whose changes are sent. 'NULL' (the default) sends every input the viewer changes through a Shiny input control, except free-text, password and file inputs; inputs set from JavaScript (sign-in, tables, plots) are left out |
tab_input |
The navbar/tabset input id, if any |
surveys |
Show PostHog surveys (the dashboard feedback popups) in this app. 'FALSE' for tools people use to enter or grade data, where a popup would interrupt the work |
force |
Track outside Connect too (see [posthog_enabled()]) |
NULL, invisibly