diff --git a/index.html b/index.html index ac7fa08..da00fb0 100644 --- a/index.html +++ b/index.html @@ -95,6 +95,7 @@

Package summary
  • TNTP brand colors and palettes with the tntp_colors() and tntp_palette() functions
  • A TNTP ggplot2 theme using brand fonts (tntp_style())
  • +
  • The tntp_cred() functions for securely managing credentials (passwords, API keys, etc.) in R.
  • TNTP-themed RMarkdown templates, for starting a new analysis with a shell that can already generate a TNTP-themed .docx report
  • Functions for initializing a new repository or project folder with TNTP-standard directories and documentation
  • Survey analysis tools such as factorize_df(), recode_to_binary(), and functions for dealing with check-all style questions
  • @@ -114,7 +115,9 @@

    Installing the tntpr package<

    Once installed, you load it like any other package.

     library(tntpr)
    -

    To update tntpr, you’ll need to unload it (or start a fresh R session) and then run the install_github('tntp/tntpr') command again.

    +

    To update tntpr, you’ll need to first unload it (or start a fresh R session). You can then run the code above below.

    +
    +tntpr::update_tntpr()

    Feature Requests and Bug Reports diff --git a/pkgdown.yml b/pkgdown.yml index 116993c..10b605d 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: visualization-cookbook: visualization-cookbook.html -last_built: 2024-02-01T22:20Z +last_built: 2024-02-06T17:35Z urls: reference: https://tntp.github.io/tntpr/reference article: https://tntp.github.io/tntpr/articles diff --git a/search.json b/search.json index a5b62fb..105ea95 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"how-to-create-tntp-style-graphics","dir":"Articles","previous_headings":"","what":"How to create TNTP style graphics","title":"TNTP Visualization Cookbook","text":"TNTP data team, developed R package R cookbook make process creating publication-ready graphics -house style using R’s ggplot2 library reproducible process, well making easier people new R create graphics. ’ll get can put together various elements graphics, let’s get admin way first…","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"install-the-tntpr-package","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Install the tntpr package","title":"TNTP Visualization Cookbook","text":"tntpr CRAN, install directly Github using devtools. devtools package installed, run first line code well. command also work updating tntpr already installed.","code":"# install.packages('devtools') devtools::install_github('tntp/tntpr')"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"load-all-the-libraries-you-need","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Load all the libraries you need","title":"TNTP Visualization Cookbook","text":"steps cookbook - create charts R general - require certain packages installed loaded. use following packages.","code":"# NOTE: We are not simply loading `tidyverse` in this vignette due to how vignettes # are built to create the documentation website. In other contexts, however, we # would simply use `library(tidyverse)` instead of loading many of the packages individually. library(tntpr) library(ggplot2) library(dplyr) library(tidyr) library(purrr) library(stringr) library(forcats) library(ggalt) library(ggridges)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"creating-plots-with-tntp_style","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Creating plots with tntp_style()","title":"TNTP Visualization Cookbook","text":"tntpr package contains function tntp_style(). add TNTP’s custom ggplot2 theme plots controls items like fonts, font size, titles axis labels, tick marks, gridlines, legend. function ensures maintain consistency across org look plots. Plus, style created design team ensure look aesthetically pleasing. function contains parameters users can adjust items font, font size, text colors, title legend position, whether show legend title, axis title, grid lines. parameters default values users need set . Consult function’s documentation ?tntp_style information parameters. Note colors lines case line chart bars bar chart, come box tntp_style() function, need explicitly set standard ggplot chart functions.","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"example-with-tntp_style","dir":"Articles","previous_headings":"How to create TNTP style graphics > Creating plots with tntp_style()","what":"Example with tntp_style()","title":"TNTP Visualization Cookbook","text":"quick example using tntp_style() theme.","code":"# base plot we will reuse in this section plt <- ggplot(ggplot2::mpg, aes(displ, hwy)) + geom_point() + labs( title = 'Cars with higher displacement\\nhave a lower MPG', subtitle = 'Displacement vs. MPG', caption = \"Data from ggplot's mpg dataset\", x = 'Engine Displ.', y = 'MPG' ) plt + tntp_style()"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"setting-font-family-and-font-sizes","dir":"Articles","previous_headings":"How to create TNTP style graphics > Creating plots with tntp_style()","what":"Setting font family and font sizes","title":"TNTP Visualization Cookbook","text":"highlight two parameters tntp_style() can help customize plot. family family parameter lets set text font family. changes font family items, including plot axis titles, legend titles text, axis text. parameter defaults ‘Halyard Display’, TNTP’s font style, uses ‘sans’ ‘Halyard Display’ available. receive warning specified font found. can also specify separate header font using header_family parameter. need manually import additional fonts, including Halyard fonts, using extrafont package available R. Follow steps import fonts: Download Halyard Display Fonts .ttf forms Data Analytics Sharepoint “Fonts” category. Open fonts folder laptop (Settings -> Personalization -> Fonts) drag drop Halyard Fonts install computer. RStudio, install extrafont package install.packages('extrafont). Import fonts extrafont database extrafont::font_import(). needs done . process long, can significantly shortened importing Halyard fonts using extrafont::font_import(pattern = 'Halyard'). Register extra fonts R using extrafont::loadfonts(). needs done R session, done automatically loading tntpr library. can check see fonts available R windowsFonts() Windows quartzFonts() Mac. base_size tntp_style() function allows parameter called base_size controls font sizes. default value 28 recommended minimum 15. number represents plot title’s font size. font sizes, subtitles, axis labels text, legend labels text also adjusted based base_size value. font sizes base_size set default 28: Plot title: 28 Plot subtitle: 22.4 Caption: 11.2 Axis title: 16.8 Axis text: 16.8","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"further-customizing-plots-outside-tntp_style","dir":"Articles","previous_headings":"How to create TNTP style graphics > Creating plots with tntp_style()","what":"Further customizing plots outside tntp_style()","title":"TNTP Visualization Cookbook","text":"tntp_style() adds TNTP’s ggplot2 theme plot. Users needing customization can stack themes adding additional theme() layer adding tntp_style(). example, following plot sets font ‘sans’ font size 20 tntp_style(). manually changes subtitle font ‘serif’ subtitle size 25 additional theme(). Please don’t use combination real plot! can also add theme elements coincide parameter tntp_style(). example, add border around plot theme element. see available settings can adjust theme element, see documentation ?theme.","code":"plt + tntp_style(show_axis_titles = TRUE, family = 'sans', base_size = 20) + theme(plot.subtitle = ggplot2::element_text(family = 'serif', size = 25)) plt + tntp_style(show_axis_titles = TRUE) + theme(panel.border = element_rect(color = \"black\", fill = NA))"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"using-tntp-brand-colors","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Using TNTP brand colors","title":"TNTP Visualization Cookbook","text":"tntpr package includes functions allow easily use TNTP brand colors visualizations.","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"colors","dir":"Articles","previous_headings":"How to create TNTP style graphics > Using TNTP brand colors","what":"Colors","title":"TNTP Visualization Cookbook","text":"primary function ’ll use tntp_colors(), takes human-friendly color names arguments returns character vector equivalent hex codes: companion function show_tntp_colors(), make quick display given colors plot window. can also use show_tntp_colors() color arguments display available colors names:","code":"tntp_colors(\"green\", \"mint\") #> [1] \"#317D5C\" \"#E2EDDC\" show_tntp_colors('green', 'moss', 'mint') # Note: the cex_label parameter is used to adjust the relative font size show_tntp_colors(cex_label = 0.7)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"palettes","dir":"Articles","previous_headings":"How to create TNTP style graphics > Using TNTP brand colors","what":"Palettes","title":"TNTP Visualization Cookbook","text":"color palettes used frequently visualizations. tntp_palette() function allows access pre-determined palettes easily: Palettes can reversed setting reverse = TRUE, can quickly displayed using show_tntp_palette() function: list visualization pre-set palettes, run function arguments: example plots show incorporate functions ggplot2 visualizations.","code":"tntp_palette(\"likert_6\") #> [1] \"#C2A60A\" \"#F2CF13\" \"#FDE57B\" \"#8FB09D\" \"#317D5C\" \"#1D4935\" show_tntp_palette(\"likert_6\", reverse = TRUE) show_tntp_palette()"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"example-plots","dir":"Articles","previous_headings":"","what":"Example Plots","title":"TNTP Visualization Cookbook","text":"now show examples plots frequently use TNTP using fake data set tntpr package. Let’s first load clean data set. lower font size plots 16.","code":"# load fake data into global environment # remove all salaries of 0 county_data <- tntpr::fake_county |> filter(t_salary > 0) avg_salary <- county_data |> filter(t_salary != 0) |> group_by(school_year) |> summarize(avg_salary = mean(t_salary, na.rm = TRUE), .groups = \"drop\") base_font_size <- 16"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-line-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a line chart","title":"TNTP Visualization Cookbook","text":"","code":"#Make plot ggplot(avg_salary, aes(x = school_year, y = avg_salary)) + geom_line(colour = tntp_colors(\"green\"), linewidth = 1) + scale_y_continuous(labels = scales::dollar, limits = c(0, 5000)) + labs( title=\"Average Teacher Salaries\", subtitle = \"Teacher salaries remained constant between 2012 and 2015\" ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-multiple-line-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a multiple line chart","title":"TNTP Visualization Cookbook","text":"Note multiple line chart, overwrote ggplot2’s default color scheme incorporate TNTP colors. pulled hex codes colors wanted use tntp_palette() added chart scale_colour_manual().","code":"#Prepare data school_salary <- county_data |> filter(t_salary != 0) |> group_by(school_year, school_name) |> summarize(avg_salary = mean(t_salary, na.rm = TRUE), .groups = \"drop\") # create list of school names so we can easily filter data set for the number of schools we want school_names <- unique(school_salary$school_name) # only plot two schools line_plot_schools <- school_salary |> filter(school_name %in% school_names[1:3]) ggplot(line_plot_schools, aes(x = school_year, y = avg_salary, color = school_name)) + geom_line(linewidth = 1) + scale_y_continuous(labels = scales::dollar, limits = c(0, 5000)) + scale_colour_manual(values = tntp_palette(\"colorful\")) + labs( title=\"Average Teacher Salaries\", subtitle = \"Teacher salaries remained constant between 2012 and 2015\" ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-bar-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a bar chart","title":"TNTP Visualization Cookbook","text":"","code":"#Prepare data bar_df <- school_salary |> filter( school_year == 2015, school_name %in% school_names[1:5] ) |> # add line breaks for better plotting mutate(school_name = str_wrap(school_name, 7)) ggplot(bar_df, aes(x = school_name, y = avg_salary)) + geom_bar(stat=\"identity\", position=\"identity\", fill= tntp_colors('gold')) + scale_y_continuous(labels = scales::dollar, limits = c(0, 5000)) + labs( title=\"Acacia had higher average salaries in 2015\", subtitle = \"Average teacher salaries in 2015 by school\" ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-stacked-bar-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a stacked bar chart","title":"TNTP Visualization Cookbook","text":"stacked bar chart uses percentages y-axis. Note formatting y-axis create percentages: scale_y_continuous(labels = scales::percent, limits = c(0,1)). set limits = c(0,1) ensure y-axis limits run 0% 100%. working percentages, axis (almost) always run 0% 100%. Additionally, geom_bar() set stat = \"identity\". tells ggplot2 plot data -aggregate data making plot. often easier aggregate data outside ggplot2, transparent, easier check. also replaced geom_bar(stat = \"identity\", position = \"stack\") geom_col() (parameters needed) arrive plot. example shows proportions, might want make stacked bar chart showing number values instead - easy change! value passed position argument determine stacked chart shows proportions actual values. position = \"fill\" draw stacks proportions, position = \"identity\" draw number values.","code":"#prepare data stacked_df <- county_data |> filter( school_year == 2015, school_name %in% school_names[1:5] ) |> mutate(t_salary_cut = cut(t_salary, breaks = c(0, 2500, 3500, 4500, 10000), labels = c(\"under $2.5k\", \"$2.5k-$3.5k\", \"$3.5k-$4.5k\", \"$4.5k+\"))) |> group_by(school_name, t_salary_cut) |> summarise(n_cut_school = n(), .groups = \"drop_last\") |> mutate( n_cut_salary = sum(n_cut_school, na.rm = TRUE), perc_in_each_cut = n_cut_school / n_cut_salary ) |> # add line breaks for better plotting mutate(school_name = str_wrap(school_name, 7)) #set order of stacks by changing factor levels stacked_df$t_salary_cut = factor(stacked_df$t_salary_cut, levels = rev(levels(stacked_df$t_salary_cut))) ggplot( data = stacked_df, aes(x = school_name, y = perc_in_each_cut, fill = t_salary_cut) ) + geom_bar(stat = \"identity\", position = \"stack\") + scale_y_continuous(labels = scales::percent, limits = c(0,1)) + scale_fill_manual(values = tntp_palette(\"greens\")) + labs(title = \"Most teachers earn between $2.5K and $4.5K\", subtitle = \"Percentage of teachers by salary range\") + theme(legend.position = \"top\", legend.justification = \"left\") + guides(fill = guide_legend(reverse = TRUE)) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-grouped-bar-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a grouped bar chart","title":"TNTP Visualization Cookbook","text":"Making grouped bar chart similar making bar chart. just need change position = \"identity\" position_dodge2(preserve = \"single\"). Note use named vector colors_to_use expressly map colors values. safe way ensure properly mapping colors values.","code":"# only plot the lowest and highest earning groups earnings_to_keep <- levels(stacked_df$t_salary_cut)[c(4,1)] # map bar colors to values colors_to_use <- tntp_colors('yellow', 'green') |> set_names(earnings_to_keep) dodged_df <- stacked_df |> # only plot the lowest and highest earning groups filter(t_salary_cut %in% !!earnings_to_keep) |> # switch order of factors so that the lowest earnings plot first mutate(t_salary_cut = factor(t_salary_cut, levels = earnings_to_keep)) ggplot(dodged_df, aes(x = school_name, y = perc_in_each_cut, fill = t_salary_cut)) + geom_bar(stat = \"identity\", position = position_dodge2(preserve = \"single\")) + scale_y_continuous(labels = scales::percent, limits = c(0,1)) + scale_fill_manual(values = colors_to_use) + labs(title = \"More teachers earn over $4.5k than under $2.5k\", subtitle = \"Percentage of teachers by salary range\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-scatterplot","dir":"Articles","previous_headings":"Example Plots","what":"Make a scatterplot","title":"TNTP Visualization Cookbook","text":"","code":"# create data set showing school test scores and average school salaries scores_salary <- county_data |> group_by(school_name) |> summarize( avg_test_score = mean(sch_ela_avg + sch_math_avg, na.rm=FALSE), avg_salary = mean(t_salary, na.rm = FALSE), enrollment = mean(sch_enroll_2015, na.rm = TRUE), .groups = 'drop' ) |> mutate(perc_rank_test_score = percent_rank(avg_test_score)) |> drop_na() ggplot(scores_salary, aes(avg_salary, perc_rank_test_score)) + geom_point(color = tntp_colors('tangerine'), alpha = 0.9, size = 3) + labs( title = 'Schools with higher salaries do not have higher test scores', subtitle = 'Relationship between school test scores and salaries', x = 'Average school salary', y = 'Percentile rank test score' ) + scale_x_continuous(labels = scales::dollar) + scale_y_continuous(labels = scales::percent) + tntp_style(base_size = base_font_size, show_axis_titles = TRUE)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-dumbbell-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a dumbbell chart","title":"TNTP Visualization Cookbook","text":"Another way showing difference dumbbell chart. Note geom_dumbell() comes ggalt package.","code":"dumbbell_df <- dodged_df |> pivot_wider(id_cols = 'school_name', names_from = 't_salary_cut', values_from = 'n_cut_school') |> mutate(across(where(is.numeric), ~replace_na(.x, 0))) ggplot(dumbbell_df, aes(x = `under $2.5k`, xend = `$4.5k+`, y = fct_reorder(school_name, `under $2.5k`)), group = school_names) + geom_dumbbell( color = tntp_colors(\"light_grey\"), size = 3, colour_x = tntp_colors('gold'), colour_xend = tntp_colors('green'), show.legend = TRUE ) + labs(title = \"More teachers earn over $4.5k than under $2.5k\", subtitle = \"Number of teachers by salary range\", x = \"Number of teachers earnign a given salary\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-histogram","dir":"Articles","previous_headings":"Example Plots","what":"Make a histogram","title":"TNTP Visualization Cookbook","text":"","code":"# number of teachers per school number_teachers_school <- county_data |> count(school_year, school_name) ggplot(number_teachers_school, aes(n)) + geom_histogram(binwidth = 5, colour = \"white\", fill = tntp_colors('navy')) + labs( title = \"Schools have a wide distribution in the number of teachers\", subtitle = \"Total number of teachers per school\", x = 'Number of teacher in school', y = 'Count' ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"making-density-plots","dir":"Articles","previous_headings":"Example Plots","what":"Making density plots","title":"TNTP Visualization Cookbook","text":"ggridges package contains additional plots plotting distributions using ridgeline plots.","code":"ggplot(county_data, aes(x = t_salary, y = school_year, group = school_year, fill = factor(school_year))) + geom_density_ridges(quantile_lines = TRUE, quantiles = 4) + scale_x_continuous(labels = scales::dollar) + labs(title = \"Income distrubutions for teachers has remained constant\", subtitle = \"Income distrubution and quantiles for teachers\") + tntp_style(base_size = base_font_size) + theme(legend.position = \"none\") + scale_fill_manual(values = tntp_palette('colorful'))"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"working-with-survey-data","dir":"Articles","previous_headings":"","what":"Working with survey data","title":"TNTP Visualization Cookbook","text":"often work survey data TNTP. highlight couple examples plotting survey data. use teacher_survey data set tntpr package, fake teacher survey. Let’s start loading data set calculating averages.","code":"teacher_survey <- tntpr::teacher_survey # the y-axis will contain text of an entire survey question # we want to place line breaks in this text so plots look better axis_line_breaks <- 40 # scales in HE questions, in order starting with the strongest agree_disagree_scale <- rev(c(\"Strongly Agree\", \"Agree\", \"Somewhat Agree\", \"Somewhat Disagree\", \"Disagree\", \"Strongly Disagree\")) # put survey into long form and clean up question names teacher_survey_he <- teacher_survey |> select(-timing) |> pivot_longer(cols = everything(), names_to = 'question', values_to = 'response') # calculate percentage of responses to each high expectations question teacher_survey_he_perc <- teacher_survey_he |> drop_na(\"response\") |> # calculate the number of responses for each response option count(question, response, name = 'n_response') |> # calculate the number of responses for each question group_by(question) |> mutate(n_question = sum(n_response)) |> ungroup() |> # calculate percentages mutate( # calculate percentages percent = n_response / n_question, # make a column that is text of the percent for plotting percent_pretty = scales::percent(percent, accuracy = 1) ) # calculate percentage of strongly agree and agree teacher_survey_he_perc <- teacher_survey_he_perc |> mutate(scale_strength = ifelse(response %in% !!agree_disagree_scale[c(5,6)], 'Strong response', 'Weak response')) |> group_by(question, scale_strength) |> mutate(strong_response_percent = sum(percent)) |> ungroup() |> mutate( strong_response_percent = ifelse(response == 'Agree', strong_response_percent, NA), # create line breaks for questions ,which will make plots look better question = str_wrap(question, axis_line_breaks), response = factor(response, levels = agree_disagree_scale) )"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"plot-likert-items---highlights-top-two","dir":"Articles","previous_headings":"Working with survey data","what":"Plot likert items - highlights top two","title":"TNTP Visualization Cookbook","text":"first plot calls two highest response values, ‘Strongly Agree’ ‘Agree’. Note tntp_style() function alter font size family text within geom_text() set manually.","code":"ggplot(teacher_survey_he_perc, aes(percent, question, fill = response)) + geom_col() + geom_text( aes(label = scales::percent(strong_response_percent, accuracy = 1), x = strong_response_percent), color = 'white', fontface='bold', family = \"Halyard Display\", size = 5, hjust = 1.05 ) + scale_x_continuous(labels = scales::percent, limits = c(0,1)) + scale_fill_manual(values = tntp_palette(\"top2_6\"), drop = FALSE) + guides(fill=guide_legend(nrow=2, byrow=TRUE, reverse = TRUE)) + labs(title = \"High Expectations Survey Responses\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"plot-likert-items---diverging","dir":"Articles","previous_headings":"Working with survey data","what":"Plot likert items - diverging","title":"TNTP Visualization Cookbook","text":"","code":"legend_order <- c(agree_disagree_scale[c(1,2,3)], agree_disagree_scale[c(6,5,4)]) teacher_survey_div <- teacher_survey_he_perc |> mutate( perc_diverge = ifelse(str_detect(response, '[D|d]isagree'), percent * -1, percent), response = factor(response, levels = legend_order) ) ggplot(teacher_survey_div, aes(x = perc_diverge, y = question, fill = response)) + geom_col() + scale_fill_manual( values = tntp_palette(\"likert_6\"), drop = FALSE, breaks = agree_disagree_scale, labels = agree_disagree_scale ) + geom_vline(aes(xintercept = 0), linetype = 1, linewidth = 1.2, alpha = .7) + scale_x_continuous(limits = c(-1, 1), breaks = seq(-1, 1, .25), labels = function(x) scales::percent(abs(x))) + labs(title = \"High Expectations Survey Responses\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Dustin Pashouwer. Maintainer.","code":""},{"path":"https://tntp.github.io/tntpr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Firke S, Russ J, Spurrier , Pashouwer D, Mullan K, Orr S, Talcott S (2024). tntpr: Data Analysis Tools Customized TNTP. R package version 0.1.1, https://tntp.github.io/tntpr/, https://github.com/tntp/tntpr.","code":"@Manual{, title = {tntpr: Data Analysis Tools Customized for TNTP}, author = {Sam Firke and Jake Russ and Alex Spurrier and Dustin Pashouwer and Kate Mullan and Shane Orr and Sam Talcott}, year = {2024}, note = {R package version 0.1.1, https://tntp.github.io/tntpr/}, url = {https://github.com/tntp/tntpr}, }"},{"path":[]},{"path":"https://tntp.github.io/tntpr/index.html","id":"about","dir":"","previous_headings":"","what":"About","title":"Data Analysis Tools Customized for TNTP","text":"tntpr package makes data science TNTP easier accurate supplying tools needed common TNTP analyses. package specifically serves TNTP analysis community, functions can tailored exact use cases.","code":""},{"path":"https://tntp.github.io/tntpr/index.html","id":"package-summary","dir":"","previous_headings":"","what":"Package summary","title":"Data Analysis Tools Customized for TNTP","text":"highlights package include: TNTP brand colors palettes tntp_colors() tntp_palette() functions TNTP ggplot2 theme using brand fonts (tntp_style()) TNTP-themed RMarkdown templates, starting new analysis shell can already generate TNTP-themed .docx report Functions initializing new repository project folder TNTP-standard directories documentation Survey analysis tools factorize_df(), recode_to_binary(), functions dealing check-style questions Wrappers quickly making typical TNTP-style charts (e.g., bar chart means variable 1 grouped variable 2) Education-specific data management functions (e.g., date_to_sy() convert continuous hire dates school years using specified cutoff date) Built-fake data sets practice , including student achievement data (wisc), teacher data (fake_county) survey data (teacher_survey) tntpr built work tidyverse set packages.","code":""},{"path":"https://tntp.github.io/tntpr/index.html","id":"installing-the-tntpr-package","dir":"","previous_headings":"","what":"Installing the tntpr package","title":"Data Analysis Tools Customized for TNTP","text":"tntpr currently CRAN, ’ll need install package GitHub repository using devtools. devtools package installed, run first line code well: installed, load like package. update tntpr, ’ll need unload (start fresh R session) run install_github('tntp/tntpr') command .","code":"# install.packages('devtools') devtools::install_github('tntp/tntpr') library(tntpr)"},{"path":"https://tntp.github.io/tntpr/index.html","id":"feature-requests-and-bug-reports","dir":"","previous_headings":"","what":"Feature Requests and Bug Reports","title":"Data Analysis Tools Customized for TNTP","text":"data problem think tntpr help ? Find bug working tntpr package? Please create issue.","code":""},{"path":"https://tntp.github.io/tntpr/reference/SegoeUI.html","id":null,"dir":"Reference","previous_headings":"","what":"Segoe UI font name R variable aliases — font_se","title":"Segoe UI font name R variable aliases — font_se","text":"font_an == \"Segoe UI\"","code":""},{"path":"https://tntp.github.io/tntpr/reference/SegoeUI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Segoe UI font name R variable aliases — font_se","text":"","code":"font_se"},{"path":"https://tntp.github.io/tntpr/reference/SegoeUI.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Segoe UI font name R variable aliases — font_se","text":"length 1 character vector","code":""},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":null,"dir":"Reference","previous_headings":"","what":"Bar chart of counts with TNTP polish — bar_chart_counts","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"Takes user supplied data frame turns designated column N bar chart (uses position dodge ggplot2).","code":""},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"","code":"bar_chart_counts( df, var, group_var = NULL, labels = \"n\", var_color = \"green\", group_colors = NULL, title = NULL, var_label = NULL, digits = 1, font = \"Halyard Display\", font_size = 12 )"},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"df data.frame used bar chart var unquoted column name variable count group_var (optional) unquoted column name group variable. specified, get 2-variable clustered bar chart. left blank, single variable bar chart. labels labels show count (\"n\") percentage (\"pct\")? var_color color non-grouped charts; set TNTP green default. group_colors, strings tried tntp_colors automatically. c(\"red\", \"green\") get official TNTP colors, c(\"red\", \"brown\") get base R red blue. group_colors character vector group colors, specific palette desired title main chart title var_label label x-axis digits integer indicating number decimal places used percentages. truncating, ties rounded , like MS Excel, .e., 10.5 11.5 become 11 12. ** base R's default behavior. font font chart text; Segoe UI default font_size size chart text; set 12 default","code":""},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"","code":"# An N bar chart by default # All examples use font = \"sans\" to avoid triggering font warnings mtcars |> bar_chart_counts(var = cyl, title = \"Number of mtcars by cylinder\", font = \"sans\") # Use a grouping variable mtcars |> bar_chart_counts(var = cyl, group_var = vs, labels = \"pct\", title = \"% of V vs. Straight engines by # of cylinders\", font = \"sans\") # Change default color mtcars |> bar_chart_counts(var = cyl, var_color = \"orange\", title = \"Number of mtcars by cylinder\", font = \"sans\") # Specify color by group mtcars |> bar_chart_counts(am, cyl, group_colors = c(\"orange\", \"green\", \"navy\"), labels = \"pct\", font = \"sans\")"},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":null,"dir":"Reference","previous_headings":"","what":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"function run columns treated check_all_recode(). Takes data.frame range columns containing answer choices check---apply question tabulates results. People select choices (.e., answer question) omitted denominator. make sense, question's choices MECE, NA option. works \"\" open-response text field, recoded binary variable check_all_recode.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"","code":"check_all_count(dat, ...)"},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"dat data.frame survey data ... unquoted column names containing range answer choices. Can specified individually, range, .e., q1_1:q1_5, using helper functions dplyr::select().","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"Returns data.frame tabulated results (n ","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"","code":"x <- data.frame( # 4th person didn't respond at all unrelated = 1:5, q1_1 = c(\"a\", \"a\", \"a\", NA, NA), q1_2 = c(\"b\", \"b\", NA, NA, NA), q1_3 = c(NA, NA, \"c\", NA, NA), q1_other = c(NA, \"something else\", NA, NA, \"not any of these\") ) library(dplyr) # for the %>% pipe #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union x %>% check_all_recode(q1_1:q1_other) %>% check_all_count(q1_1:q1_other) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> response n percent #> a 3 0.75 #> b 2 0.50 #> c 1 0.25 #> Other 2 0.50 # You can use any of the dplyr::select() helpers to identify the columns: x %>% check_all_recode(contains(\"q1\")) %>% check_all_count(contains(\"q1\")) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> response n percent #> a 3 0.75 #> b 2 0.50 #> c 1 0.25 #> Other 2 0.50"},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":null,"dir":"Reference","previous_headings":"","what":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"survey software returns check---apply response columns missing values indicate either respondent skipped question entirely, select particular answer choice. count responses properly, cases respondent check choices - .e., skipped question - counted denominator (assuming choices completely exhaustive, NA option). function takes data.frame range columns containing answer choices check---apply question updates columns data.frame contain one three values: 1 choice selected; 0 respondent chose another option one; NA respondent skipped question (.e., select choices) thus response truly missing. also takes single text values column adds label attribute data.frame columns. function accomodates open-response column, get correct denominator respondents skipped check variables written something . passing offered choices implicit rejection , \"missing.\" text variable throw warning - may okay - recoded binary 1/0 variable indicating response. text variable assigned label \"\". Consider preserving original respondent text values prior point separate column needed. check_all_recode() prepares data.frame call sister function check_all_count(). label attribute accessed function.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"","code":"check_all_recode(dat, ..., set_labels = TRUE)"},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"dat data.frame survey data ... unquoted variable names containing answer choices. Can specified range, .e., q1_1:q1_5 using helper functions dplyr::select(). set_labels label attribute columns -written column text? Allow TRUE unless currently label attributes wish overwrite.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"Returns original data.frame specified column range updated, label attributes questions.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"","code":"x <- data.frame( # 4th person didn't respond at all unrelated = 1:5, q1_1 = c(\"a\", \"a\", \"a\", NA, NA), q1_2 = c(\"b\", \"b\", NA, NA, NA), q1_3 = c(NA, NA, \"c\", NA, NA), q1_other = c(NA, \"something else\", NA, NA, \"not any of these\") ) library(dplyr) # for the %>% pipe x %>% check_all_recode(q1_1:q1_other) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> unrelated q1_1 q1_2 q1_3 q1_other #> 1 1 1 1 0 0 #> 2 2 1 1 0 1 #> 3 3 1 0 1 0 #> 4 4 NA NA NA NA #> 5 5 0 0 0 1 # You can use any of the dplyr::select() helpers to identify the columns: x %>% check_all_recode(contains(\"q1\")) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> unrelated q1_1 q1_2 q1_3 q1_other #> 1 1 1 1 0 0 #> 2 2 1 1 0 1 #> 3 3 1 0 1 0 #> 4 4 NA NA NA NA #> 5 5 0 0 0 1"},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Choose a text color given a background color — choose_text_color","title":"Choose a text color given a background color — choose_text_color","text":"Choose text color given background color","code":""},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Choose a text color given a background color — choose_text_color","text":"","code":"choose_text_color(bg_color)"},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Choose a text color given a background color — choose_text_color","text":"bg_color color","code":""},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Choose a text color given a background color — choose_text_color","text":"\"black\" \"white\"","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP colors — colors_tntp","title":"TNTP colors — colors_tntp","text":"list colors superseded new brand colors new function tntp_colors().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP colors — colors_tntp","text":"","code":"colors_tntp"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"TNTP colors — colors_tntp","text":"object class character length 34.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP colors — colors_tntp","text":"","code":"if (FALSE) { tntp_colors() }"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":null,"dir":"Reference","previous_headings":"","what":"Likert pallette — colors_tntp_likert","title":"Likert pallette — colors_tntp_likert","text":"likert palette superseded new brand colors new function tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Likert pallette — colors_tntp_likert","text":"","code":"colors_tntp_likert"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Likert pallette — colors_tntp_likert","text":"object class character length 7.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Likert pallette — colors_tntp_likert","text":"","code":"if (FALSE) { tntp_palette('likert_6') }"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":null,"dir":"Reference","previous_headings":"","what":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"likert palette superseded new brand colors new functions tntp_colors() tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"","code":"colors_tntp_likert_orange_to_green"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"object class character length 7.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"","code":"if (FALSE) { tntp_palette('bg_6') }"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP pallette — colors_tntp_palette","title":"TNTP pallette — colors_tntp_palette","text":"list colors superseded new brand colors new function tntp_colors().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP pallette — colors_tntp_palette","text":"","code":"colors_tntp_palette"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"TNTP pallette — colors_tntp_palette","text":"object class character length 16.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP pallette — colors_tntp_palette","text":"","code":"if (FALSE) { tntp_colors() }"},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a date value into its school year. — date_to_sy","title":"Convert a date value into its school year. — date_to_sy","text":"Checks see date past user-specified cutoff point delineating school years, maps appropriate year.","code":""},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a date value into its school year. — date_to_sy","text":"","code":"date_to_sy(date_var, last_day_of_sy = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a date value into its school year. — date_to_sy","text":"date_var date convert. Can Date object string form 'YYYY-MM-DD' 'MM/DD/YYYY' last_day_of_sy cutoff date, date considered part following school year. year argument matter. Defaults (noisily) July 1st.","code":""},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a date value into its school year. — date_to_sy","text":"Returns character vector format \"2013 - 2014\"","code":""},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a date value into its school year. — date_to_sy","text":"","code":"date_to_sy(as.Date(\"2014-05-05\"), as.Date(\"2000-07-01\")) #> [1] \"2013 - 2014\" date_to_sy(as.Date(\"2014-07-05\"), as.Date(\"2000-07-01\")) #> [1] \"2014 - 2015\""},{"path":"https://tntp.github.io/tntpr/reference/dot-onAttach.html","id":null,"dir":"Reference","previous_headings":"","what":"Title — .onAttach","title":"Title — .onAttach","text":"Title","code":""},{"path":"https://tntp.github.io/tntpr/reference/dot-onAttach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Title — .onAttach","text":"","code":".onAttach(libname, pkgname)"},{"path":"https://tntp.github.io/tntpr/reference/dot-onAttach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Title — .onAttach","text":"libname library name pkgname package name","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"function examines column data.frame; finds column composed solely values provided lvls argument updates factor variables, levels order provided. alternative calling dplyr::mutate_at factor() identifying specific variables want transform, several repeated sets responses.","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"","code":"factorize_df(dat, lvls, ignore.case = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"dat data.frame factor variables stored characters. lvls factor levels variable(s), order. question whose possible responses subset another question's, use function; manipulate specific columns dplyr::mutate_at. ignore.case Logical. TRUE, match without checking case, using capitalization lvls parameter final output. provided, function provide warning detects columns match without checking case coerce .","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"data.frame factorization completed place.","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"","code":"teacher_survey |> factorize_df(lvls = c(\"Strongly Disagree\", \"Disagree\", \"Somewhat Disagree\", \"Somewhat Agree\", \"Agree\", \"Strongly Agree\")) #> ℹ Changed the following columns to factors: `It's fair to expect students in #> this class to master these standards by the end of the year.`, `One year is #> enough time for students in this class to master these standards.`, `All #> students in my class can master the grade-level standards by the end of the #> year.`, and `The standards are appropriate for the students in this class.` #> # A tibble: 20 × 5 #> timing It's fair to expect st…¹ One year is enough t…² All students in my c…³ #> #> 1 Pre Disagree Disagree Agree #> 2 Pre Disagree Somewhat Agree Agree #> 3 Pre Somewhat Disagree Somewhat Disagree Strongly Agree #> 4 Pre Disagree Strongly Disagree Strongly Agree #> 5 Pre Agree Somewhat Disagree Strongly Disagree #> 6 Pre Strongly Disagree Somewhat Agree Somewhat Disagree #> 7 Pre Agree Strongly Agree Strongly Disagree #> 8 Pre Agree Disagree Somewhat Agree #> 9 Pre Strongly Disagree Disagree Somewhat Agree #> 10 Pre Somewhat Agree Somewhat Disagree Agree #> 11 Post Strongly Disagree Somewhat Agree Somewhat Disagree #> 12 Post Somewhat Agree Disagree Somewhat Disagree #> 13 Post Somewhat Disagree Somewhat Agree Strongly Disagree #> 14 Post Strongly Agree Strongly Agree Disagree #> 15 Post Strongly Agree Somewhat Disagree Strongly Disagree #> 16 Post Disagree Disagree Agree #> 17 Post Strongly Agree Agree Agree #> 18 Post Strongly Agree Strongly Agree Disagree #> 19 Post Somewhat Disagree Somewhat Agree Agree #> 20 Post Somewhat Agree Strongly Agree Strongly Disagree #> # ℹ abbreviated names: #> # ¹​`It's fair to expect students in this class to master these standards by the end of the year.`, #> # ²​`One year is enough time for students in this class to master these standards.`, #> # ³​`All students in my class can master the grade-level standards by the end of the year.` #> # ℹ 1 more variable: #> # `The standards are appropriate for the students in this class.` # prints warning due to case mismatches: teacher_survey |> factorize_df(lvls = c(\"Strongly disagree\", \"Disagree\", \"Somewhat disagree\", \"Somewhat agree\", \"Agree\", \"Strongly agree\")) #> Warning: ! Columns `It's fair to expect students in this class to master these standards #> by the end of the year.`, `One year is enough time for students in this class #> to master these standards.`, `All students in my class can master the #> grade-level standards by the end of the year.`, and `The standards are #> appropriate for the students in this class.` were NOT matched, but would #> match if `ignore.case` was set to \"TRUE\" #> Warning: ! No columns matched. Check spelling & capitalization of your levels. #> # A tibble: 20 × 5 #> timing It's fair to expect st…¹ One year is enough t…² All students in my c…³ #> #> 1 Pre Disagree Disagree Agree #> 2 Pre Disagree Somewhat Agree Agree #> 3 Pre Somewhat Disagree Somewhat Disagree Strongly Agree #> 4 Pre Disagree Strongly Disagree Strongly Agree #> 5 Pre Agree Somewhat Disagree Strongly Disagree #> 6 Pre Strongly Disagree Somewhat Agree Somewhat Disagree #> 7 Pre Agree Strongly Agree Strongly Disagree #> 8 Pre Agree Disagree Somewhat Agree #> 9 Pre Strongly Disagree Disagree Somewhat Agree #> 10 Pre Somewhat Agree Somewhat Disagree Agree #> 11 Post Strongly Disagree Somewhat Agree Somewhat Disagree #> 12 Post Somewhat Agree Disagree Somewhat Disagree #> 13 Post Somewhat Disagree Somewhat Agree Strongly Disagree #> 14 Post Strongly Agree Strongly Agree Disagree #> 15 Post Strongly Agree Somewhat Disagree Strongly Disagree #> 16 Post Disagree Disagree Agree #> 17 Post Strongly Agree Agree Agree #> 18 Post Strongly Agree Strongly Agree Disagree #> 19 Post Somewhat Disagree Somewhat Agree Agree #> 20 Post Somewhat Agree Strongly Agree Strongly Disagree #> # ℹ abbreviated names: #> # ¹​`It's fair to expect students in this class to master these standards by the end of the year.`, #> # ²​`One year is enough time for students in this class to master these standards.`, #> # ³​`All students in my class can master the grade-level standards by the end of the year.` #> # ℹ 1 more variable: #> # `The standards are appropriate for the students in this class.` "},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":null,"dir":"Reference","previous_headings":"","what":"Fake teacher roster dataset from OpenSDP — fake_county","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"Fake County synthetic panel dataset contains approximately 40,000 records comprising four years data roughly 10,000 teachers per year. dataset includes information teacher demographics, teaching assignments, salary, credentials, experience, evaluation scores, hiring retention status. also includes information school types average student characteristics school. real teachers dataset, based real data. Fake County developed offshoot Strategic Data Project's work human capital diagnostics school districts state education departments, can used teaching collaboration. data synthesized using R synthpop package.","code":""},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"","code":"fake_county"},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"data frame 39,339 rows 38 variables: tid double: Teacher ID fake_data double: Record Simulated school_year double: School Year school_code double: School Code school_name character: School Name t_male double: Teacher Male t_race_ethnicity double: Teacher Race/Ethnicity t_job_area double: Teacher Assignment Type t_salary double: Monthly Salary t_nbpts double: Teacher National Board Certification t_tenured double: Teacher Tenured t_experience double: Years Teaching Experience t_fte double: Teacher's FTE Status t_highest_degree double: Teacher's Highest Degree t_licensed_stem double: Teacher Licensed STEM Field t_eval_obs double: Evaluation Summary Observation Score t_eval_growth double: Evaluation Summary Student Growth Score t_stay double: Teacher School Following Year t_transfer double: Teacher Different School Following Year t_leave double: Teacher Teaching Fake County Schools Following Year t_novice double: Teacher Novice First-Year Teacher t_new_hire double: Teacher Teach Fake County Prior Year sch_elem double: School Elementary School sch_middle double: School Middle School sch_high double: School High School sch_alternative double: School Alternative School sch_regular double: School Regular School sch_title_1 double: School Title 1 School sch_magnet double: School Magnet School sch_vocational double: School Vocational School sch_region double: School Region Code sch_calendar_type double: School Calendar Type sch_iep_pct double: School Special Education Student Share 2012-15 sch_minority_pct double: School Minority Student Share 2012-15 sch_frpl_pct double: School Free Reduced Price Lunch Student Share 2012-15 sch_ela_avg double: School ELA Test Score Average 2012-15 (standard deviations) sch_math_avg double: School Math Test Score Average 2012-15 (standard deviations) sch_enroll_2015 double: School Enrollment 2015","code":""},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"https://github.com/OpenSDP/fake-county, posted Creative Commons license.","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":null,"dir":"Reference","previous_headings":"","what":"Create sequential figure numbers — figureN","title":"Create sequential figure numbers — figureN","text":"Create sequential figure numbers","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create sequential figure numbers — figureN","text":"","code":"figureN(x)"},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create sequential figure numbers — figureN","text":"x character string description figure","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create sequential figure numbers — figureN","text":"nothing","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create sequential figure numbers — figureN","text":"","code":"# not run, in RMarkdown doc: `r figureN(\"Distribution of cars by cylinder count\")` #"},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks if a font family is usable and returns a usable font if not — get_usable_family","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"Helper function. Checks given family value available, returns default font family (\"sans\" user provided)","code":""},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"","code":"get_usable_family(family, silent = FALSE, default_family = \"sans\")"},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"family font family check character silent logical. TRUE raise warning font family unavailable default_family defaults \"sans\", can set another fallback family.","code":""},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"character usable font family","code":""},{"path":"https://tntp.github.io/tntpr/reference/header_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert header_script_tntp. — header_tntp","title":"Insert header_script_tntp. — header_tntp","text":"Call function insert header 'TNTP R Shell.R'.","code":""},{"path":"https://tntp.github.io/tntpr/reference/header_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert header_script_tntp. — header_tntp","text":"","code":"header_tntp()"},{"path":"https://tntp.github.io/tntpr/reference/import_segoe_ui.html","id":null,"dir":"Reference","previous_headings":"","what":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","title":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","text":"option tntpr.loadfonts -- set TRUE -- call extrafont::loadfonts() register non-core fonts R PDF & PostScript devices. running Windows, package calls function register non-core fonts Windows graphics device.","code":""},{"path":"https://tntp.github.io/tntpr/reference/import_segoe_ui.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","text":"","code":"import_segoe_ui()"},{"path":"https://tntp.github.io/tntpr/reference/import_segoe_ui.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","text":"take care ensuring PDF/PostScript usage. location font directory displayed base import complete. highly recommended install system way font wish use programs.","code":""},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Validate color inputs — is_color","title":"Validate color inputs — is_color","text":"Validate color inputs","code":""},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Validate color inputs — is_color","text":"","code":"is_color(x)"},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Validate color inputs — is_color","text":"x color","code":""},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Validate color inputs — is_color","text":"TRUE x can interpreted color","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert all labelled-class columns to factors. — labelled_to_factors","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"Deprecated. Use as_factor() function haven package instead functionality. Takes data.frame, checks columns class labelled haven package, converts factor class.","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"","code":"labelled_to_factors(labels_df)"},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"labels_df data.frame containing columns class labelled","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"Returns data.frame.","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"","code":"tntpr::fake_county |> haven::as_factor() #> # A tibble: 39,339 × 38 #> tid fake_data school_year school_code school_name t_male t_race_ethnicity #> #> 1 100001 1 2014 1303122 Birch Middle Male African American #> 2 100001 1 2015 1303122 Birch Middle Male African American #> 3 100002 1 2012 1301958 Kingside Hi… Female White #> 4 100002 1 2013 1301958 Kingside Hi… Female White #> 5 100002 1 2014 1301958 Kingside Hi… Female White #> 6 100002 1 2015 1301958 Kingside Hi… Female White #> 7 100003 1 2012 1301575 Eliot Eleme… Female White #> 8 100003 1 2013 1301575 Eliot Eleme… Female White #> 9 100003 1 2014 1301575 Eliot Eleme… Female White #> 10 100004 1 2012 1300549 Junction Hi… Male White #> # ℹ 39,329 more rows #> # ℹ 31 more variables: t_job_area , t_salary , t_nbpts , #> # t_tenured , t_experience , t_fte , t_highest_degree , #> # t_licensed_stem , t_eval_obs , t_eval_growth , t_stay , #> # t_transfer , t_leave , t_novice , t_new_hire , #> # sch_elem , sch_middle , sch_high , sch_alternative , #> # sch_regular , sch_title_1 , sch_magnet , …"},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Pallette names — palette_names","title":"Pallette names — palette_names","text":"list palette names superseded new brand colors new functions tntp_colors() tntp_palette(). see new brand palettes, use show_tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pallette names — palette_names","text":"","code":"palette_names"},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Pallette names — palette_names","text":"object class character length 7.","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pallette names — palette_names","text":"","code":"if (FALSE) { show_tntp_palette() }"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP branded color palettes — palette_tntp","title":"TNTP branded color palettes — palette_tntp","text":"function superseded tntp_colors() improved functionality includes recent TNTP brand colors. function creates user defined color palette combinations eleven colors. nine TNTP approved colors: dark_blue, medium_blue, light_blue, green, orange, gold, dark_grey (dark_gray), medium_grey (medium_gray), light_grey (light_gray). White black also available.","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP branded color palettes — palette_tntp","text":"","code":"palette_tntp(...)"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP branded color palettes — palette_tntp","text":"... supply quoted color names include color palette","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP branded color palettes — palette_tntp","text":"","code":"library(ggplot2) pal1_tntp <- tntp_colors(\"green\", \"gold\", \"orange\") pal2_tntp <- tntp_colors(\"navy\", \"cerulean\", \"sky\") p <- ggplot(mtcars, aes(wt, mpg)) p <- p + geom_point(aes(colour = factor(cyl))) p # Change colors to created palette p <- p + scale_color_manual(values = pal1_tntp) p g <- ggplot(mtcars, aes(factor(cyl), mean(mpg))) g <- g + geom_bar(aes(fill = factor(cyl)), stat = \"identity\") g # Change fill to created palette g <- g + scale_fill_manual(values = pal2_tntp) g"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp_scales.html","id":null,"dir":"Reference","previous_headings":"","what":"scale_palette_tntp — palette_tntp_scales","title":"scale_palette_tntp — palette_tntp_scales","text":"function superseded tntp_palette() includes new brand colors.","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp_scales.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"scale_palette_tntp — palette_tntp_scales","text":"","code":"palette_tntp_scales(palette = palette_names)"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp_scales.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"scale_palette_tntp — palette_tntp_scales","text":"palette palette","code":""},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Attempt to parse a date with common formats — parse_date","title":"Attempt to parse a date with common formats — parse_date","text":"Helper function date_to_sy. Returns date object , noisily attempts parse string form YYYY-MM-DD MM/DD/YYYY. date parsed, throws error.","code":""},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Attempt to parse a date with common formats — parse_date","text":"","code":"parse_date(date)"},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Attempt to parse a date with common formats — parse_date","text":"date character Date vector parse","code":""},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Attempt to parse a date with common formats — parse_date","text":"Date vector","code":""},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"Calculate percent non-missing values character vector containing values interest. helper function factorize_df().","code":""},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"","code":"prop_matching(vec, valid_strings, ignore.case = FALSE)"},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"vec character vector. valid_strings values variable can possibly take . ignore.case TRUE, ignores case matching","code":""},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"numeric proportion 0 1.","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":null,"dir":"Reference","previous_headings":"","what":"Recode a variable into binary groups, e.g., ","title":"Recode a variable into binary groups, e.g., ","text":"Recodes character variable binary result, two-level factor. values matching supplied character strings to_match vector coded first level factor; values coded level. NA remains NA. default factor labels \"Selected\" \"selected\" can overridden. recoding case-sensitive; specify \"agree\" top-2 value, \"Agree\" counted Top-2, vice versa.","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recode a variable into binary groups, e.g., ","text":"","code":"recode_to_binary( x, to_match = c(\"strongly agree\", \"agree\"), label_matched = \"Selected\", label_unmatched = \"Not selected\" )"},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Recode a variable into binary groups, e.g., ","text":"x character factor vector recoded to_match character vector strings put first level factor. Defaults \"strongly agree\" \"agree\" can overwritten. label_matched factor label values match strings specified to_match? Defaults \"Selected\" label_unmatched factor label values match strings specified to_match? Defaults \"selected\".","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Recode a variable into binary groups, e.g., ","text":"factor variable (nicer ordering calls janitor::tabyl) values mapped two levels.","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Recode a variable into binary groups, e.g., ","text":"","code":"agreement <- c( \"Strongly agree\", \"Agree\", \"Somewhat agree\", \"Somewhat disagree\", \"Strongly disagree\", \"Frogs\", NA ) recode_to_binary(agreement) # default values of \"strongly agree\" and \"agree\" are used for recoding #> [1] Selected Selected Not selected Not selected Not selected #> [6] Not selected #> Levels: Selected Not selected recode_to_binary(agreement, label_matched = \"Top-2 Agree\", label_unmatched = \"Not in Top-2\" ) # custom labels of factor levels #> [1] Top-2 Agree Top-2 Agree Not in Top-2 Not in Top-2 Not in Top-2 #> [6] Not in Top-2 #> Levels: Top-2 Agree Not in Top-2 recode_to_binary(agreement, \"frogs\") #> [1] Not selected Not selected Not selected Not selected Not selected #> [6] Selected #> Levels: Selected Not selected recode_to_binary( agreement, \"frogs\", \"FROGS!!!\", \"not frogs\" ) # custom matching values & labels of factor levels #> [1] not frogs not frogs not frogs not frogs not frogs FROGS!!! #> Levels: FROGS!!! not frogs freq <- c(\"always\", \"often\", \"sometimes\", \"never\") recode_to_binary(freq, \"always\", \"always\", \"less than always\") #> [1] always less than always less than always less than always #> Levels: always less than always"},{"path":"https://tntp.github.io/tntpr/reference/scale_colour_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","title":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","text":"function deprecated. Please use scale_color_manual(values = tntp_palette(palette_name)) instead","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_colour_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","text":"","code":"scale_colour_tntp(palette = palette_names, drop = FALSE, ...) scale_color_tntp(palette = palette_names, drop = FALSE, ...)"},{"path":"https://tntp.github.io/tntpr/reference/scale_colour_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","text":"palette character string describing desired palette drop drop ... arguments pass ggplot2::discrete_scale()","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"scale_fill_tntp — scale_fill_tntp","title":"scale_fill_tntp — scale_fill_tntp","text":"function deprecated. Please use scale_fill_manual(values = tntp_palette(palette_name)) instead","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"scale_fill_tntp — scale_fill_tntp","text":"","code":"scale_fill_tntp(palette = palette_names, drop = FALSE, ...)"},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"scale_fill_tntp — scale_fill_tntp","text":"palette One : \"default\", \"likert_4pt\", \"likert_5pt\", \"likert_6pt\", \"colors_tntp_old\" drop drop ... additional arguments passed ggplot2::discrete_scale()","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"scale_fill_tntp — scale_fill_tntp","text":"","code":"library(ggplot2) library(dplyr) x <- mtcars %>% count(cyl, am) %>% mutate(am = as.factor(am)) ggplot(x, aes(x = cyl, y = n, fill = am)) + # you need a fill aesthetic geom_col() + scale_fill_manual(values = tntp_palette())"},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"internal function calls standard formatting options Data Memo RMarkdown template moved keep actual memo template cleaner easier use","code":""},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"","code":"set_data_memo_formatting()"},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"nothing","code":""},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"","code":"# not run: set_data_memo_formatting()"},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"Create new repository Bitbucket, set working directory folder run function. set main repo folder well single subfolder can work immediate project. must specify subfolder name well long name associated project analyst(s) working . latter two values used create README.Md file.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"","code":"setup_repo(subfolder, proj_name, analyst_name)"},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"subfolder character vector containing concise name project subfolder. E.g., repository name city \"Anywhere City\", project subfolder might \"ela_access\" \"aps_talent_landscape\"). proj_name longer, full name subfolder project. appear subfolder's README.md file. E.g., \"Access Grade-Level ELA Content Pilot.\" analyst_name name(s) analysts currently working subfolder project. appear subfolder's README.md file.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"","code":"# After the user has created a repository \"Anywhere City\" and set their working # directory to that folder: ## not run # setup_repo(\"ela_access\", # \"Access to Grade-Level ELA Content\", # \"Dustin Pashouwer and Sam Firke\")"},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"repository might represent region, like \"Anywhere City\", major client contract, like \"Midwestern Charter Network. Within repo subfolder analysis project. function creates subfolder populates folders README. use: within existing repository Bitbucket, set working directory folder run function create sub-folder. Use setup_repo() blank new repository add first project subfolder create RProject .gitignore files. Add subsequent analysis project folders function.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"","code":"setup_subdirectory(subfolder, proj_name, analyst_name)"},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"subfolder character vector containing concise name project subfolder. E.g., repository name city \"Anywhere City\", project subfolder might \"ela_access\" \"aps_talent_landscape\"). proj_name longer, full name subfolder project. appear subfolder's README.md file. analyst_name name(s) analysts currently working subfolder project. appear subfolder's README.md file.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"","code":"# When there's already a repository \"Anywhere City\" with an RProject and a .gitignore # and a new project analysis subfolder is needed within that repo: ## not run # setup_subdirectory(\"ela_access\", # \"Equitable Access to Grade-Level ELA\", # \"Dustin Pashouwer and Sam Firke\")"},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":null,"dir":"Reference","previous_headings":"","what":"Write datatable to temp excel file and open it. — show_in_excel","title":"Write datatable to temp excel file and open it. — show_in_excel","text":"Write datatable temp excel file open .","code":""},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write datatable to temp excel file and open it. — show_in_excel","text":"","code":"show_in_excel(.data)"},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write datatable to temp excel file and open it. — show_in_excel","text":".data Dataframe","code":""},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write datatable to temp excel file and open it. — show_in_excel","text":"Returns data.frame.","code":""},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":null,"dir":"Reference","previous_headings":"","what":"Update case of a character vector — standardize_case","title":"Update case of a character vector — standardize_case","text":"Helper function factorize_df(). Returns vector length vec, values match values valid_strings updated case valid_strings","code":""},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update case of a character vector — standardize_case","text":"","code":"standardize_case(vec, new_case)"},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update case of a character vector — standardize_case","text":"vec character vector want update new_case character vector correctly cased strings","code":""},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Update case of a character vector — standardize_case","text":"character vector length vec","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":null,"dir":"Reference","previous_headings":"","what":"Create sequential table numbers — tableN","title":"Create sequential table numbers — tableN","text":"Create sequential table numbers","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create sequential table numbers — tableN","text":"","code":"tableN(x)"},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create sequential table numbers — tableN","text":"x character string description figure","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create sequential table numbers — tableN","text":"nothing","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create sequential table numbers — tableN","text":"","code":"# not run, in RMarkdown doc: `r tableN(\"Distribution of cars by cylinder count\")`"},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":null,"dir":"Reference","previous_headings":"","what":"Teacher survey data — teacher_survey","title":"Teacher survey data — teacher_survey","text":"Simulated teacher survey data. Data includes teh four TNTP high expectations questions.","code":""},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Teacher survey data — teacher_survey","text":"","code":"teacher_survey"},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Teacher survey data — teacher_survey","text":"## `teacher survey` data frame 5 columns 20 rows. five columns `timing` column, followed four column four high expectations questions. Responses 'strongly agree' strongly disagree' 6-point scale.","code":""},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Teacher survey data — teacher_survey","text":"simulated `data-raw/teacher_survey.R`","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP's ggplot2 theme — theme_tntp","title":"TNTP's ggplot2 theme — theme_tntp","text":"theme superseded [tntp_style()]. Ggplot2 theme customized TNTP aesthetics","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP's ggplot2 theme — theme_tntp","text":"","code":"theme_tntp( show_legend_title = TRUE, base_size = 12, base_family = \"Segoe UI\", grid_color = \"grey93\", title_align = \"center\", title_color = \"black\", title_size = 12, subtitle_align = \"center\", subtitle_color = \"black\", subtitle_size = 12, caption_align = \"right\", caption_color = \"black\", caption_size = 12 )"},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP's ggplot2 theme — theme_tntp","text":"show_legend_title logical. legend title shown? Leave TRUE want change legend title subsequent line + labs(...). base_size base font size base_family base font family grid_color color major gridlines title_align alignment main title, defaults \"center\"; also accepts \"left\" \"right\" title_color color title text title_size size title text subtitle_align alignment sub-title, defaults \"center\"; also accepts \"left\" \"right\" subtitle_color color subtitle text subtitle_size size subtitle text caption_align alignment caption, defaults \"right\"; also accepts \"left\" \"center\" caption_color color caption text caption_size size caption text","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":null,"dir":"Reference","previous_headings":"","what":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"theme superseded tntp_style().","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"","code":"theme_tntp_2018( base_family = \"Segoe UI\", base_size = 11.5, plot_title_family = base_family, plot_title_size = 18, plot_title_face = \"bold\", plot_title_margin = 10, subtitle_family = base_family, subtitle_size = 12, subtitle_face = \"plain\", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = \"plain\", caption_family = base_family, caption_size = 9, caption_face = \"italic\", caption_margin = 10, axis_text = TRUE, axis_text_size = base_size, axis_title_family = subtitle_family, axis_title_size = 9, axis_title_face = \"plain\", axis_title_just = \"rt\", plot_margin = ggplot2::margin(30, 30, 30, 30), grid_col = \"grey93\", grid = TRUE, axis_col = \"#cccccc\", axis = FALSE, ticks = FALSE )"},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"base_family, base_size base font family size plot_title_family, plot_title_face, plot_title_size, plot_title_margin plot title family, face, size margi subtitle_family, subtitle_face, subtitle_size plot subtitle family, face size subtitle_margin plot subtitle margin bottom (single numeric value) strip_text_family, strip_text_face, strip_text_size facet label font family, face size caption_family, caption_face, caption_size, caption_margin plot caption family, face, size margin axis_text add x y axes text? X, Y axis_text_size font size axis text axis_title_family, axis_title_face, axis_title_size axis title font family, face size axis_title_just axis title font justification, one [blmcrt] plot_margin plot margin (specify ggplot2::margin()) grid_col, axis_col grid & axis colors; default #cccccc grid panel grid (TRUE, FALSE, combination X, x, Y, y) axis add x y axes? TRUE, FALSE, \"xy\" ticks ticks TRUE add ticks","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"building-upon-theme-tntp","dir":"Reference","previous_headings":"","what":"Building upon theme_tntp","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"function setup way can customize one just wrapping call changing parameters. See source examples.","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"gotchas","dir":"Reference","previous_headings":"","what":"Gotchas","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"distinctions font names various devices. Names work display graphics devices bitmap ones png may work well PostScript PDF ones. may need two versions font-based theme function work particular situation. situation usually arises using newer font many weights somewhat irregular internal font name patterns. option hrbrthemes.loadfonts -- set TRUE -- call extrafont::loadfonts() register non-core fonts R PDF & PostScript devices. running Windows, package calls function register non-core fonts Windows graphics device.","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"","code":"if (FALSE) { library(ggplot2) library(dplyr) # seminal scatterplot ggplot(mtcars, aes(mpg, wt)) + geom_point() + labs( x = \"Fuel effiiency (mpg)\", y = \"Weight (tons)\", title = \"Seminal ggplot2 scatterplot example\", subtitle = \"A plot that is only useful for demonstration purposes\", caption = \"Brought to you by the letter 'g'\" ) + theme_ipsum() # seminal bar chart update_geom_font_defaults() count(mpg, class) %>% ggplot(aes(class, n)) + geom_col() + geom_text(aes(label = n), nudge_y = 3) + labs( x = \"Fuel efficiency (mpg)\", y = \"Weight (tons)\", title = \"Seminal ggplot2 bar chart example\", subtitle = \"A plot that is only useful for demonstration purposes\", caption = \"Brought to you by the letter 'g'\" ) + theme_ipsum(grid = \"Y\") + theme(axis.text.y = element_blank()) }"},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP Brand Colors — tntp_colors","title":"TNTP Brand Colors — tntp_colors","text":"Translate human friendly TNTP brand color names like \"medium_blue\" accurate hex values use plotting. function can also used show named vector available TNTP brand colors values. Use show_tntp_colors() quickly visualize selected colors plot window. often used palettes TNTP colors, see tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP Brand Colors — tntp_colors","text":"","code":"tntp_colors(...) show_tntp_colors( ..., pattern = NULL, labels = TRUE, borders = NULL, cex_label = 1, ncol = NULL )"},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP Brand Colors — tntp_colors","text":"... Supply quoted TNTP color names return. colors specified, returns available colors. pattern Optional regular expression. provided, return brand colors match regular expression labels Logical. Label colors names hex values? borders Border color tile. Default uses par(\"fg\"). Use border = NA omit borders. cex_label Size printed labels, multiplier default size. ncol Number columns. supplied, tries square possible.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP Brand Colors — tntp_colors","text":"","code":"library(ggplot2) # Use tntp_colors() to retrieve a single color... ggplot(mtcars, aes(wt, mpg)) + geom_point(color = tntp_colors('green')) #... multiple colors ... ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_manual(values = tntp_colors('green', 'navy', 'red')) #... or a list of all possible TNTP brand colors tntp_colors() #> mint|light_green gray|grey|light_gray|light_grey #> \"#E2EDDC\" \"#F1F1EE\" #> white black #> \"#FFFFFF\" \"#000000\" #> yellow|medium_yellow navy|blue #> \"#FDE57B\" \"#00355F\" #> pink|light_red red #> \"#FDDACA\" \"#C31F46\" #> green charcoal|dark_gray|dark_grey #> \"#317D5C\" \"#4A4A4A\" #> tangerine|orange salmon|medium_red #> \"#F26C4C\" \"#DA8988\" #> gold moss|medium_green #> \"#F2CF13\" \"#8FB09D\" #> sky|light_blue cerulean|medium_blue #> \"#81D3EB\" \"#00A5C7\" #> light_yellow medium_gray|medium_grey #> \"#FAEDB8\" \"#9E9E9C\" #> dark_gold dark_green #> \"#C2A60A\" \"#1D4935\" #> dark_red green_4 #> \"#7C132C\" \"#60977D\" #> green_2 blue_4 #> \"#B9CFBD\" \"#006D93\" #> blue_2 red_4 #> \"#41BCD9\" \"#CF5467\" #> red_2 yellow_4 #> \"#ECB2A9\" \"#F8DA47\" #> yellow_2 gray_4|grey_4 #> \"#FCE99A\" \"#747473\" #> gray_2|grey_2 #> \"#C7C7C5\" # Use show_tntp_colors() to quickly see brand colors in the plotting window show_tntp_colors('mint', 'moss', 'green') # You can also use a pattern to return similar colors show_tntp_colors(pattern = 'green') # You can see all colors (and names) by running it with no arguments show_tntp_colors()"},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP Credential Get/Set Command — tntp_cred","title":"TNTP Credential Get/Set Command — tntp_cred","text":"wrapper around keyring package secure credential management. tntp_cred() attempt get credential, credential found prompt add (return ). tntp_cred_set() set credential. default prompt overwriting current credentials. tntp_cred_list() list current credentials sorted service username.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP Credential Get/Set Command — tntp_cred","text":"","code":"tntp_cred(service, username = NULL, keyring = NULL, prompt = NULL) tntp_cred_set( service = NULL, username = NULL, keyring = NULL, prompt = NULL, overwrite = NULL ) tntp_cred_list(service = NULL, keyring = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP Credential Get/Set Command — tntp_cred","text":"service identifier credential pulling setting username OPTIONAL. Can used specify different usernames service keyring OPTIONAL. Can used specify specific keyring prompt OPTIONAL. text displayed input box key setting? overwrite OPTIONAL. default, tntp_cred_set() prompt finds credential already saved. Set TRUE overwrite without prompting FALSE throw error current credential found.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"TNTP Credential Get/Set Command — tntp_cred","text":"stored (newly created) credential","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP Credential Get/Set Command — tntp_cred","text":"","code":"if (FALSE) { # Using tntp_cred() with qualtRics library(qualtRics) # If no credential is set, this command will prompt for it first qualtrics_token <- tntp_cred(\"QUALTRICS_TOKEN\") qualtrics_api_credentials(api_key = qualtrics_token, base_url = 'tntp.co1.qualtrics.com') # To overwrite your Qualtrics credential tntp_cred(\"QUALTRICS_TOKEN\", .set = TRUE) }"},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":null,"dir":"Reference","previous_headings":"","what":"Common TNTP Color Palettes — tntp_palette","title":"Common TNTP Color Palettes — tntp_palette","text":"Use see","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Common TNTP Color Palettes — tntp_palette","text":"","code":"tntp_palette(palette = \"likert_6\", reverse = FALSE) show_tntp_palette(..., reverse = FALSE, pattern = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Common TNTP Color Palettes — tntp_palette","text":"palette Name TNTP palette want use. see available palettes, use show_tntp_palette() reverse Logical. set TRUE, reverses direction palette. ... Supply quoted TNTP palette names visualize. names specified, shows available palettes. pattern Optional regular expression. provided, return palettes match regular expression","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Common TNTP Color Palettes — tntp_palette","text":"","code":"library(ggplot2) # Use to add a common palette to a ggplot visualization ggplot(diamonds, aes(y = color, fill = cut)) + geom_bar(position = \"fill\") + scale_fill_manual(values = tntp_palette('blues', reverse = TRUE)) # Use show_tntp_palette() to visualize a single or multiple palettes show_tntp_palette('likert_7') show_tntp_palette('bg_5', 'likert_5') # You can use a pattern to show similar palettes show_tntp_palette(pattern = 'top2') show_tntp_palette(pattern = '_6') # Or run it with no specified palettes to see all available palettes show_tntp_palette() # For creating a continuous color palette, use scale_color_gradient() # along with tntp_colors(): ggplot(mtcars, aes(hp, disp, color = mpg)) + geom_point(size = 3) + scale_color_gradient(low = tntp_colors('red'), high = tntp_colors('green'))"},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Create TNTP themed ggplot2 charts — tntp_style","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"custom theme including TNTP fonts defaults styling ggplot2 charts.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"","code":"tntp_style( family = \"Halyard Display\", header_family = family, base_size = 28, text_color = \"#222222\", caption_color = \"#7D7E81\", show_legend_title = FALSE, show_axis_titles = FALSE, grid = FALSE, grid_color = \"#CBCBCB\", title_align = \"left\", legend_align = \"left\", caption_align = \"right\" )"},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"family Base font family. Defaults \"Halyard Display\". header_family Font family title subtitle. Defaults base font family. base_size Base font size. Recommended minimum value 15. text_color Text color titles, axes, legends, facets. caption_color Text color caption. show_legend_title Logical. legend title shown? Leave TRUE want change legend title subsequent line + labs(...). show_axis_titles axis titles shown? Use TRUE FALSE toggle titles, x y show just axis title. grid grid lines shown? Use TRUE FALSE toggle grid lines, string combination X, x, Y, y major minor x y grid lines. grid_color Grid line color. title_align, legend_align, caption_align Alignment title, legend, caption. Accepts left, right, center.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"","code":"if (FALSE) { library(tntpr) library(dplyr) library(ggplot2) fake_county |> filter(t_salary > 0) |> ggplot(aes(t_experience, t_salary)) + geom_point() + scale_y_continuous(labels = scales::dollar) + labs( title = \"Salary Increases with Experience\", subtitle = \"With significant variation at all levels\", x = \"Years of Experience\", caption = \"Data from the Fake County Data Set\" ) + tntp_style(show_axis_titles = \"x\") frpl_experience <- fake_county |> mutate(frpl_bucket = cut(sch_frpl_pct, breaks = c(0, 20, 40, 60, 80, 100), labels = c(\"0-20%\", \"20-40%\", \"40-60%\", \"60-80%\", \"80-100%\") )) |> group_by(frpl_bucket) |> summarize(avg_experience = mean(t_experience, na.rm = TRUE)) |> mutate( label = as.character(round(avg_experience, digits = 1)), label = if_else(frpl_bucket == \"0-20%\", paste0(label, \"\\nYears of\\nExperience\"), label) ) frpl_experience |> ggplot(aes(frpl_bucket, avg_experience)) + geom_col(fill = if_else(frpl_experience$frpl_bucket == \"60-80%\", tntp_colors(\"tangerine\"), tntp_colors(\"medium_gray\") )) + geom_text(aes(label = label), nudge_y = -0.25, vjust = 1, color = \"white\", size = 5, lineheight = 1, family = \"Segoe UI\" ) + labs( title = \"High Poverty Schools have Less Experienced Teachers\", x = \"% of Student Body Receiving Free/Reduced Lunch\" ) + scale_y_continuous(breaks = seq(0, 20, 4)) + tntp_style( base_size = 20, show_axis_titles = \"x\" ) }"},{"path":"https://tntp.github.io/tntpr/reference/tntpr.html","id":null,"dir":"Reference","previous_headings":"","what":"Data Analysis Tools Customized for TNTP — tntpr","title":"Data Analysis Tools Customized for TNTP — tntpr","text":"-house TNTP R package. Includes tools data manipulation, analysis, reporting, including making TNTP-themed charts documents. TNTP data-using staff, though available broader public.","code":""},{"path":[]},{"path":"https://tntp.github.io/tntpr/reference/update_geom_font_defaults.html","id":null,"dir":"Reference","previous_headings":"","what":"Update matching font defaults for text geoms — update_geom_font_defaults","title":"Update matching font defaults for text geoms — update_geom_font_defaults","text":"Updates [ggplot2::geom_label] [ggplot2::geom_text] font defaults","code":""},{"path":"https://tntp.github.io/tntpr/reference/update_geom_font_defaults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update matching font defaults for text geoms — update_geom_font_defaults","text":"","code":"update_geom_font_defaults( family = \"Segoe UI\", face = \"plain\", size = 3.5, color = \"#2b2b2b\" )"},{"path":"https://tntp.github.io/tntpr/reference/update_geom_font_defaults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update matching font defaults for text geoms — update_geom_font_defaults","text":"family, face, size, color font family name, face, size color","code":""},{"path":"https://tntp.github.io/tntpr/reference/update_tntpr.html","id":null,"dir":"Reference","previous_headings":"","what":"Re-install the tntpr package from GitHub. — update_tntpr","title":"Re-install the tntpr package from GitHub. — update_tntpr","text":"Re-install tntpr package GitHub.","code":""},{"path":"https://tntp.github.io/tntpr/reference/update_tntpr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Re-install the tntpr package from GitHub. — update_tntpr","text":"","code":"update_tntpr()"},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":null,"dir":"Reference","previous_headings":"","what":"Fake student data from the Wisconsin State Dept. of Ed — wisc","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"generated data set containing data 1200 imaginary individual K-12 students Wisconsin. nested within 6 schools 3 districts. adapting source, Sam switched school district variables (multiple districts per school) made minor changes, including dropping columns understand seem relevant (e.g., variables like \"luck\" used calculate reading math scores).","code":""},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"","code":"wisc"},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"data frame 2700 rows 26 variables: student_id numeric: student's unique ID # grade numeric: grade level district numeric: district code school numeric: school code white numeric: student white? black numeric: student black? hisp numeric: student Hispanic? indian numeric: student Native-American Indian? asian numeric: student Asian? econ numeric: student economically-disadvantaged? female numeric: student female? ell numeric: student English Language Learner? disab numeric: student learning disability? year numeric: school year attday numeric: days attended readSS numeric: student's reading standardized test score mathSS numeric: student's math standardized test score proflvl factor: student's proficiency level race factor: student's single-category race","code":""},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"https://github.com/jknowles/r_tutorial_ed/, posted Creative Commons license. script used generate data set , although well documented: https://github.com/jknowles/r_tutorial_ed/blob/master/data/simulate_data.R","code":""}] +[{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"how-to-create-tntp-style-graphics","dir":"Articles","previous_headings":"","what":"How to create TNTP style graphics","title":"TNTP Visualization Cookbook","text":"TNTP data team, developed R package R cookbook make process creating publication-ready graphics -house style using R’s ggplot2 library reproducible process, well making easier people new R create graphics. ’ll get can put together various elements graphics, let’s get admin way first…","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"install-the-tntpr-package","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Install the tntpr package","title":"TNTP Visualization Cookbook","text":"tntpr CRAN, install directly Github using devtools. devtools package installed, run first line code well. command also work updating tntpr already installed.","code":"# install.packages('devtools') devtools::install_github('tntp/tntpr')"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"load-all-the-libraries-you-need","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Load all the libraries you need","title":"TNTP Visualization Cookbook","text":"steps cookbook - create charts R general - require certain packages installed loaded. use following packages.","code":"# NOTE: We are not simply loading `tidyverse` in this vignette due to how vignettes # are built to create the documentation website. In other contexts, however, we # would simply use `library(tidyverse)` instead of loading many of the packages individually. library(tntpr) library(ggplot2) library(dplyr) library(tidyr) library(purrr) library(stringr) library(forcats) library(ggalt) library(ggridges)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"creating-plots-with-tntp_style","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Creating plots with tntp_style()","title":"TNTP Visualization Cookbook","text":"tntpr package contains function tntp_style(). add TNTP’s custom ggplot2 theme plots controls items like fonts, font size, titles axis labels, tick marks, gridlines, legend. function ensures maintain consistency across org look plots. Plus, style created design team ensure look aesthetically pleasing. function contains parameters users can adjust items font, font size, text colors, title legend position, whether show legend title, axis title, grid lines. parameters default values users need set . Consult function’s documentation ?tntp_style information parameters. Note colors lines case line chart bars bar chart, come box tntp_style() function, need explicitly set standard ggplot chart functions.","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"example-with-tntp_style","dir":"Articles","previous_headings":"How to create TNTP style graphics > Creating plots with tntp_style()","what":"Example with tntp_style()","title":"TNTP Visualization Cookbook","text":"quick example using tntp_style() theme.","code":"# base plot we will reuse in this section plt <- ggplot(ggplot2::mpg, aes(displ, hwy)) + geom_point() + labs( title = 'Cars with higher displacement\\nhave a lower MPG', subtitle = 'Displacement vs. MPG', caption = \"Data from ggplot's mpg dataset\", x = 'Engine Displ.', y = 'MPG' ) plt + tntp_style()"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"setting-font-family-and-font-sizes","dir":"Articles","previous_headings":"How to create TNTP style graphics > Creating plots with tntp_style()","what":"Setting font family and font sizes","title":"TNTP Visualization Cookbook","text":"highlight two parameters tntp_style() can help customize plot. family family parameter lets set text font family. changes font family items, including plot axis titles, legend titles text, axis text. parameter defaults ‘Halyard Display’, TNTP’s font style, uses ‘sans’ ‘Halyard Display’ available. receive warning specified font found. can also specify separate header font using header_family parameter. need manually import additional fonts, including Halyard fonts, using extrafont package available R. Follow steps import fonts: Download Halyard Display Fonts .ttf forms Data Analytics Sharepoint “Fonts” category. Open fonts folder laptop (Settings -> Personalization -> Fonts) drag drop Halyard Fonts install computer. RStudio, install extrafont package install.packages('extrafont). Import fonts extrafont database extrafont::font_import(). needs done . process long, can significantly shortened importing Halyard fonts using extrafont::font_import(pattern = 'Halyard'). Register extra fonts R using extrafont::loadfonts(). needs done R session, done automatically loading tntpr library. can check see fonts available R windowsFonts() Windows quartzFonts() Mac. base_size tntp_style() function allows parameter called base_size controls font sizes. default value 28 recommended minimum 15. number represents plot title’s font size. font sizes, subtitles, axis labels text, legend labels text also adjusted based base_size value. font sizes base_size set default 28: Plot title: 28 Plot subtitle: 22.4 Caption: 11.2 Axis title: 16.8 Axis text: 16.8","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"further-customizing-plots-outside-tntp_style","dir":"Articles","previous_headings":"How to create TNTP style graphics > Creating plots with tntp_style()","what":"Further customizing plots outside tntp_style()","title":"TNTP Visualization Cookbook","text":"tntp_style() adds TNTP’s ggplot2 theme plot. Users needing customization can stack themes adding additional theme() layer adding tntp_style(). example, following plot sets font ‘sans’ font size 20 tntp_style(). manually changes subtitle font ‘serif’ subtitle size 25 additional theme(). Please don’t use combination real plot! can also add theme elements coincide parameter tntp_style(). example, add border around plot theme element. see available settings can adjust theme element, see documentation ?theme.","code":"plt + tntp_style(show_axis_titles = TRUE, family = 'sans', base_size = 20) + theme(plot.subtitle = ggplot2::element_text(family = 'serif', size = 25)) plt + tntp_style(show_axis_titles = TRUE) + theme(panel.border = element_rect(color = \"black\", fill = NA))"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"using-tntp-brand-colors","dir":"Articles","previous_headings":"How to create TNTP style graphics","what":"Using TNTP brand colors","title":"TNTP Visualization Cookbook","text":"tntpr package includes functions allow easily use TNTP brand colors visualizations.","code":""},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"colors","dir":"Articles","previous_headings":"How to create TNTP style graphics > Using TNTP brand colors","what":"Colors","title":"TNTP Visualization Cookbook","text":"primary function ’ll use tntp_colors(), takes human-friendly color names arguments returns character vector equivalent hex codes: companion function show_tntp_colors(), make quick display given colors plot window. can also use show_tntp_colors() color arguments display available colors names:","code":"tntp_colors(\"green\", \"mint\") #> [1] \"#317D5C\" \"#E2EDDC\" show_tntp_colors('green', 'moss', 'mint') # Note: the cex_label parameter is used to adjust the relative font size show_tntp_colors(cex_label = 0.7)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"palettes","dir":"Articles","previous_headings":"How to create TNTP style graphics > Using TNTP brand colors","what":"Palettes","title":"TNTP Visualization Cookbook","text":"color palettes used frequently visualizations. tntp_palette() function allows access pre-determined palettes easily: Palettes can reversed setting reverse = TRUE, can quickly displayed using show_tntp_palette() function: list visualization pre-set palettes, run function arguments: example plots show incorporate functions ggplot2 visualizations.","code":"tntp_palette(\"likert_6\") #> [1] \"#C2A60A\" \"#F2CF13\" \"#FDE57B\" \"#8FB09D\" \"#317D5C\" \"#1D4935\" show_tntp_palette(\"likert_6\", reverse = TRUE) show_tntp_palette()"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"example-plots","dir":"Articles","previous_headings":"","what":"Example Plots","title":"TNTP Visualization Cookbook","text":"now show examples plots frequently use TNTP using fake data set tntpr package. Let’s first load clean data set. lower font size plots 16.","code":"# load fake data into global environment # remove all salaries of 0 county_data <- tntpr::fake_county |> filter(t_salary > 0) avg_salary <- county_data |> filter(t_salary != 0) |> group_by(school_year) |> summarize(avg_salary = mean(t_salary, na.rm = TRUE), .groups = \"drop\") base_font_size <- 16"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-line-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a line chart","title":"TNTP Visualization Cookbook","text":"","code":"#Make plot ggplot(avg_salary, aes(x = school_year, y = avg_salary)) + geom_line(colour = tntp_colors(\"green\"), linewidth = 1) + scale_y_continuous(labels = scales::dollar, limits = c(0, 5000)) + labs( title=\"Average Teacher Salaries\", subtitle = \"Teacher salaries remained constant between 2012 and 2015\" ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-multiple-line-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a multiple line chart","title":"TNTP Visualization Cookbook","text":"Note multiple line chart, overwrote ggplot2’s default color scheme incorporate TNTP colors. pulled hex codes colors wanted use tntp_palette() added chart scale_colour_manual().","code":"#Prepare data school_salary <- county_data |> filter(t_salary != 0) |> group_by(school_year, school_name) |> summarize(avg_salary = mean(t_salary, na.rm = TRUE), .groups = \"drop\") # create list of school names so we can easily filter data set for the number of schools we want school_names <- unique(school_salary$school_name) # only plot two schools line_plot_schools <- school_salary |> filter(school_name %in% school_names[1:3]) ggplot(line_plot_schools, aes(x = school_year, y = avg_salary, color = school_name)) + geom_line(linewidth = 1) + scale_y_continuous(labels = scales::dollar, limits = c(0, 5000)) + scale_colour_manual(values = tntp_palette(\"colorful\")) + labs( title=\"Average Teacher Salaries\", subtitle = \"Teacher salaries remained constant between 2012 and 2015\" ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-bar-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a bar chart","title":"TNTP Visualization Cookbook","text":"","code":"#Prepare data bar_df <- school_salary |> filter( school_year == 2015, school_name %in% school_names[1:5] ) |> # add line breaks for better plotting mutate(school_name = str_wrap(school_name, 7)) ggplot(bar_df, aes(x = school_name, y = avg_salary)) + geom_bar(stat=\"identity\", position=\"identity\", fill= tntp_colors('gold')) + scale_y_continuous(labels = scales::dollar, limits = c(0, 5000)) + labs( title=\"Acacia had higher average salaries in 2015\", subtitle = \"Average teacher salaries in 2015 by school\" ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-stacked-bar-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a stacked bar chart","title":"TNTP Visualization Cookbook","text":"stacked bar chart uses percentages y-axis. Note formatting y-axis create percentages: scale_y_continuous(labels = scales::percent, limits = c(0,1)). set limits = c(0,1) ensure y-axis limits run 0% 100%. working percentages, axis (almost) always run 0% 100%. Additionally, geom_bar() set stat = \"identity\". tells ggplot2 plot data -aggregate data making plot. often easier aggregate data outside ggplot2, transparent, easier check. also replaced geom_bar(stat = \"identity\", position = \"stack\") geom_col() (parameters needed) arrive plot. example shows proportions, might want make stacked bar chart showing number values instead - easy change! value passed position argument determine stacked chart shows proportions actual values. position = \"fill\" draw stacks proportions, position = \"identity\" draw number values.","code":"#prepare data stacked_df <- county_data |> filter( school_year == 2015, school_name %in% school_names[1:5] ) |> mutate(t_salary_cut = cut(t_salary, breaks = c(0, 2500, 3500, 4500, 10000), labels = c(\"under $2.5k\", \"$2.5k-$3.5k\", \"$3.5k-$4.5k\", \"$4.5k+\"))) |> group_by(school_name, t_salary_cut) |> summarise(n_cut_school = n(), .groups = \"drop_last\") |> mutate( n_cut_salary = sum(n_cut_school, na.rm = TRUE), perc_in_each_cut = n_cut_school / n_cut_salary ) |> # add line breaks for better plotting mutate(school_name = str_wrap(school_name, 7)) #set order of stacks by changing factor levels stacked_df$t_salary_cut = factor(stacked_df$t_salary_cut, levels = rev(levels(stacked_df$t_salary_cut))) ggplot( data = stacked_df, aes(x = school_name, y = perc_in_each_cut, fill = t_salary_cut) ) + geom_bar(stat = \"identity\", position = \"stack\") + scale_y_continuous(labels = scales::percent, limits = c(0,1)) + scale_fill_manual(values = tntp_palette(\"greens\")) + labs(title = \"Most teachers earn between $2.5K and $4.5K\", subtitle = \"Percentage of teachers by salary range\") + theme(legend.position = \"top\", legend.justification = \"left\") + guides(fill = guide_legend(reverse = TRUE)) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-grouped-bar-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a grouped bar chart","title":"TNTP Visualization Cookbook","text":"Making grouped bar chart similar making bar chart. just need change position = \"identity\" position_dodge2(preserve = \"single\"). Note use named vector colors_to_use expressly map colors values. safe way ensure properly mapping colors values.","code":"# only plot the lowest and highest earning groups earnings_to_keep <- levels(stacked_df$t_salary_cut)[c(4,1)] # map bar colors to values colors_to_use <- tntp_colors('yellow', 'green') |> set_names(earnings_to_keep) dodged_df <- stacked_df |> # only plot the lowest and highest earning groups filter(t_salary_cut %in% !!earnings_to_keep) |> # switch order of factors so that the lowest earnings plot first mutate(t_salary_cut = factor(t_salary_cut, levels = earnings_to_keep)) ggplot(dodged_df, aes(x = school_name, y = perc_in_each_cut, fill = t_salary_cut)) + geom_bar(stat = \"identity\", position = position_dodge2(preserve = \"single\")) + scale_y_continuous(labels = scales::percent, limits = c(0,1)) + scale_fill_manual(values = colors_to_use) + labs(title = \"More teachers earn over $4.5k than under $2.5k\", subtitle = \"Percentage of teachers by salary range\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-scatterplot","dir":"Articles","previous_headings":"Example Plots","what":"Make a scatterplot","title":"TNTP Visualization Cookbook","text":"","code":"# create data set showing school test scores and average school salaries scores_salary <- county_data |> group_by(school_name) |> summarize( avg_test_score = mean(sch_ela_avg + sch_math_avg, na.rm=FALSE), avg_salary = mean(t_salary, na.rm = FALSE), enrollment = mean(sch_enroll_2015, na.rm = TRUE), .groups = 'drop' ) |> mutate(perc_rank_test_score = percent_rank(avg_test_score)) |> drop_na() ggplot(scores_salary, aes(avg_salary, perc_rank_test_score)) + geom_point(color = tntp_colors('tangerine'), alpha = 0.9, size = 3) + labs( title = 'Schools with higher salaries do not have higher test scores', subtitle = 'Relationship between school test scores and salaries', x = 'Average school salary', y = 'Percentile rank test score' ) + scale_x_continuous(labels = scales::dollar) + scale_y_continuous(labels = scales::percent) + tntp_style(base_size = base_font_size, show_axis_titles = TRUE)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-dumbbell-chart","dir":"Articles","previous_headings":"Example Plots","what":"Make a dumbbell chart","title":"TNTP Visualization Cookbook","text":"Another way showing difference dumbbell chart. Note geom_dumbell() comes ggalt package.","code":"dumbbell_df <- dodged_df |> pivot_wider(id_cols = 'school_name', names_from = 't_salary_cut', values_from = 'n_cut_school') |> mutate(across(where(is.numeric), ~replace_na(.x, 0))) ggplot(dumbbell_df, aes(x = `under $2.5k`, xend = `$4.5k+`, y = fct_reorder(school_name, `under $2.5k`)), group = school_names) + geom_dumbbell( color = tntp_colors(\"light_grey\"), size = 3, colour_x = tntp_colors('gold'), colour_xend = tntp_colors('green'), show.legend = TRUE ) + labs(title = \"More teachers earn over $4.5k than under $2.5k\", subtitle = \"Number of teachers by salary range\", x = \"Number of teachers earnign a given salary\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"make-a-histogram","dir":"Articles","previous_headings":"Example Plots","what":"Make a histogram","title":"TNTP Visualization Cookbook","text":"","code":"# number of teachers per school number_teachers_school <- county_data |> count(school_year, school_name) ggplot(number_teachers_school, aes(n)) + geom_histogram(binwidth = 5, colour = \"white\", fill = tntp_colors('navy')) + labs( title = \"Schools have a wide distribution in the number of teachers\", subtitle = \"Total number of teachers per school\", x = 'Number of teacher in school', y = 'Count' ) + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"making-density-plots","dir":"Articles","previous_headings":"Example Plots","what":"Making density plots","title":"TNTP Visualization Cookbook","text":"ggridges package contains additional plots plotting distributions using ridgeline plots.","code":"ggplot(county_data, aes(x = t_salary, y = school_year, group = school_year, fill = factor(school_year))) + geom_density_ridges(quantile_lines = TRUE, quantiles = 4) + scale_x_continuous(labels = scales::dollar) + labs(title = \"Income distrubutions for teachers has remained constant\", subtitle = \"Income distrubution and quantiles for teachers\") + tntp_style(base_size = base_font_size) + theme(legend.position = \"none\") + scale_fill_manual(values = tntp_palette('colorful'))"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"working-with-survey-data","dir":"Articles","previous_headings":"","what":"Working with survey data","title":"TNTP Visualization Cookbook","text":"often work survey data TNTP. highlight couple examples plotting survey data. use teacher_survey data set tntpr package, fake teacher survey. Let’s start loading data set calculating averages.","code":"teacher_survey <- tntpr::teacher_survey # the y-axis will contain text of an entire survey question # we want to place line breaks in this text so plots look better axis_line_breaks <- 40 # scales in HE questions, in order starting with the strongest agree_disagree_scale <- rev(c(\"Strongly Agree\", \"Agree\", \"Somewhat Agree\", \"Somewhat Disagree\", \"Disagree\", \"Strongly Disagree\")) # put survey into long form and clean up question names teacher_survey_he <- teacher_survey |> select(-timing) |> pivot_longer(cols = everything(), names_to = 'question', values_to = 'response') # calculate percentage of responses to each high expectations question teacher_survey_he_perc <- teacher_survey_he |> drop_na(\"response\") |> # calculate the number of responses for each response option count(question, response, name = 'n_response') |> # calculate the number of responses for each question group_by(question) |> mutate(n_question = sum(n_response)) |> ungroup() |> # calculate percentages mutate( # calculate percentages percent = n_response / n_question, # make a column that is text of the percent for plotting percent_pretty = scales::percent(percent, accuracy = 1) ) # calculate percentage of strongly agree and agree teacher_survey_he_perc <- teacher_survey_he_perc |> mutate(scale_strength = ifelse(response %in% !!agree_disagree_scale[c(5,6)], 'Strong response', 'Weak response')) |> group_by(question, scale_strength) |> mutate(strong_response_percent = sum(percent)) |> ungroup() |> mutate( strong_response_percent = ifelse(response == 'Agree', strong_response_percent, NA), # create line breaks for questions ,which will make plots look better question = str_wrap(question, axis_line_breaks), response = factor(response, levels = agree_disagree_scale) )"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"plot-likert-items---highlights-top-two","dir":"Articles","previous_headings":"Working with survey data","what":"Plot likert items - highlights top two","title":"TNTP Visualization Cookbook","text":"first plot calls two highest response values, ‘Strongly Agree’ ‘Agree’. Note tntp_style() function alter font size family text within geom_text() set manually.","code":"ggplot(teacher_survey_he_perc, aes(percent, question, fill = response)) + geom_col() + geom_text( aes(label = scales::percent(strong_response_percent, accuracy = 1), x = strong_response_percent), color = 'white', fontface='bold', family = \"Halyard Display\", size = 5, hjust = 1.05 ) + scale_x_continuous(labels = scales::percent, limits = c(0,1)) + scale_fill_manual(values = tntp_palette(\"top2_6\"), drop = FALSE) + guides(fill=guide_legend(nrow=2, byrow=TRUE, reverse = TRUE)) + labs(title = \"High Expectations Survey Responses\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/articles/visualization-cookbook.html","id":"plot-likert-items---diverging","dir":"Articles","previous_headings":"Working with survey data","what":"Plot likert items - diverging","title":"TNTP Visualization Cookbook","text":"","code":"legend_order <- c(agree_disagree_scale[c(1,2,3)], agree_disagree_scale[c(6,5,4)]) teacher_survey_div <- teacher_survey_he_perc |> mutate( perc_diverge = ifelse(str_detect(response, '[D|d]isagree'), percent * -1, percent), response = factor(response, levels = legend_order) ) ggplot(teacher_survey_div, aes(x = perc_diverge, y = question, fill = response)) + geom_col() + scale_fill_manual( values = tntp_palette(\"likert_6\"), drop = FALSE, breaks = agree_disagree_scale, labels = agree_disagree_scale ) + geom_vline(aes(xintercept = 0), linetype = 1, linewidth = 1.2, alpha = .7) + scale_x_continuous(limits = c(-1, 1), breaks = seq(-1, 1, .25), labels = function(x) scales::percent(abs(x))) + labs(title = \"High Expectations Survey Responses\") + tntp_style(base_size = base_font_size)"},{"path":"https://tntp.github.io/tntpr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Dustin Pashouwer. Maintainer.","code":""},{"path":"https://tntp.github.io/tntpr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Firke S, Russ J, Spurrier , Pashouwer D, Mullan K, Orr S, Talcott S (2024). tntpr: Data Analysis Tools Customized TNTP. R package version 0.1.1, https://tntp.github.io/tntpr/, https://github.com/tntp/tntpr.","code":"@Manual{, title = {tntpr: Data Analysis Tools Customized for TNTP}, author = {Sam Firke and Jake Russ and Alex Spurrier and Dustin Pashouwer and Kate Mullan and Shane Orr and Sam Talcott}, year = {2024}, note = {R package version 0.1.1, https://tntp.github.io/tntpr/}, url = {https://github.com/tntp/tntpr}, }"},{"path":[]},{"path":"https://tntp.github.io/tntpr/index.html","id":"about","dir":"","previous_headings":"","what":"About","title":"Data Analysis Tools Customized for TNTP","text":"tntpr package makes data science TNTP easier accurate supplying tools needed common TNTP analyses. package specifically serves TNTP analysis community, functions can tailored exact use cases.","code":""},{"path":"https://tntp.github.io/tntpr/index.html","id":"package-summary","dir":"","previous_headings":"","what":"Package summary","title":"Data Analysis Tools Customized for TNTP","text":"highlights package include: TNTP brand colors palettes tntp_colors() tntp_palette() functions TNTP ggplot2 theme using brand fonts (tntp_style()) tntp_cred() functions securely managing credentials (passwords, API keys, etc.) R. TNTP-themed RMarkdown templates, starting new analysis shell can already generate TNTP-themed .docx report Functions initializing new repository project folder TNTP-standard directories documentation Survey analysis tools factorize_df(), recode_to_binary(), functions dealing check-style questions Wrappers quickly making typical TNTP-style charts (e.g., bar chart means variable 1 grouped variable 2) Education-specific data management functions (e.g., date_to_sy() convert continuous hire dates school years using specified cutoff date) Built-fake data sets practice , including student achievement data (wisc), teacher data (fake_county) survey data (teacher_survey) tntpr built work tidyverse set packages.","code":""},{"path":"https://tntp.github.io/tntpr/index.html","id":"installing-the-tntpr-package","dir":"","previous_headings":"","what":"Installing the tntpr package","title":"Data Analysis Tools Customized for TNTP","text":"tntpr currently CRAN, ’ll need install package GitHub repository using devtools. devtools package installed, run first line code well: installed, load like package. update tntpr, ’ll need first unload (start fresh R session). can run code .","code":"# install.packages('devtools') devtools::install_github('tntp/tntpr') library(tntpr) tntpr::update_tntpr()"},{"path":"https://tntp.github.io/tntpr/index.html","id":"feature-requests-and-bug-reports","dir":"","previous_headings":"","what":"Feature Requests and Bug Reports","title":"Data Analysis Tools Customized for TNTP","text":"data problem think tntpr help ? Find bug working tntpr package? Please create issue.","code":""},{"path":"https://tntp.github.io/tntpr/reference/SegoeUI.html","id":null,"dir":"Reference","previous_headings":"","what":"Segoe UI font name R variable aliases — font_se","title":"Segoe UI font name R variable aliases — font_se","text":"font_an == \"Segoe UI\"","code":""},{"path":"https://tntp.github.io/tntpr/reference/SegoeUI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Segoe UI font name R variable aliases — font_se","text":"","code":"font_se"},{"path":"https://tntp.github.io/tntpr/reference/SegoeUI.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Segoe UI font name R variable aliases — font_se","text":"length 1 character vector","code":""},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":null,"dir":"Reference","previous_headings":"","what":"Bar chart of counts with TNTP polish — bar_chart_counts","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"Takes user supplied data frame turns designated column N bar chart (uses position dodge ggplot2).","code":""},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"","code":"bar_chart_counts( df, var, group_var = NULL, labels = \"n\", var_color = \"green\", group_colors = NULL, title = NULL, var_label = NULL, digits = 1, font = \"Halyard Display\", font_size = 12 )"},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"df data.frame used bar chart var unquoted column name variable count group_var (optional) unquoted column name group variable. specified, get 2-variable clustered bar chart. left blank, single variable bar chart. labels labels show count (\"n\") percentage (\"pct\")? var_color color non-grouped charts; set TNTP green default. group_colors, strings tried tntp_colors automatically. c(\"red\", \"green\") get official TNTP colors, c(\"red\", \"brown\") get base R red blue. group_colors character vector group colors, specific palette desired title main chart title var_label label x-axis digits integer indicating number decimal places used percentages. truncating, ties rounded , like MS Excel, .e., 10.5 11.5 become 11 12. ** base R's default behavior. font font chart text; Segoe UI default font_size size chart text; set 12 default","code":""},{"path":"https://tntp.github.io/tntpr/reference/bar_chart_counts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bar chart of counts with TNTP polish — bar_chart_counts","text":"","code":"# An N bar chart by default # All examples use font = \"sans\" to avoid triggering font warnings mtcars |> bar_chart_counts(var = cyl, title = \"Number of mtcars by cylinder\", font = \"sans\") # Use a grouping variable mtcars |> bar_chart_counts(var = cyl, group_var = vs, labels = \"pct\", title = \"% of V vs. Straight engines by # of cylinders\", font = \"sans\") # Change default color mtcars |> bar_chart_counts(var = cyl, var_color = \"orange\", title = \"Number of mtcars by cylinder\", font = \"sans\") # Specify color by group mtcars |> bar_chart_counts(am, cyl, group_colors = c(\"orange\", \"green\", \"navy\"), labels = \"pct\", font = \"sans\")"},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":null,"dir":"Reference","previous_headings":"","what":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"function run columns treated check_all_recode(). Takes data.frame range columns containing answer choices check---apply question tabulates results. People select choices (.e., answer question) omitted denominator. make sense, question's choices MECE, NA option. works \"\" open-response text field, recoded binary variable check_all_recode.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"","code":"check_all_count(dat, ...)"},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"dat data.frame survey data ... unquoted column names containing range answer choices. Can specified individually, range, .e., q1_1:q1_5, using helper functions dplyr::select().","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"Returns data.frame tabulated results (n ","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_count.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tabulate a range of check-all-that-apply response columns in a single table. — check_all_count","text":"","code":"x <- data.frame( # 4th person didn't respond at all unrelated = 1:5, q1_1 = c(\"a\", \"a\", \"a\", NA, NA), q1_2 = c(\"b\", \"b\", NA, NA, NA), q1_3 = c(NA, NA, \"c\", NA, NA), q1_other = c(NA, \"something else\", NA, NA, \"not any of these\") ) library(dplyr) # for the %>% pipe #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union x %>% check_all_recode(q1_1:q1_other) %>% check_all_count(q1_1:q1_other) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> response n percent #> a 3 0.75 #> b 2 0.50 #> c 1 0.25 #> Other 2 0.50 # You can use any of the dplyr::select() helpers to identify the columns: x %>% check_all_recode(contains(\"q1\")) %>% check_all_count(contains(\"q1\")) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> response n percent #> a 3 0.75 #> b 2 0.50 #> c 1 0.25 #> Other 2 0.50"},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":null,"dir":"Reference","previous_headings":"","what":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"survey software returns check---apply response columns missing values indicate either respondent skipped question entirely, select particular answer choice. count responses properly, cases respondent check choices - .e., skipped question - counted denominator (assuming choices completely exhaustive, NA option). function takes data.frame range columns containing answer choices check---apply question updates columns data.frame contain one three values: 1 choice selected; 0 respondent chose another option one; NA respondent skipped question (.e., select choices) thus response truly missing. also takes single text values column adds label attribute data.frame columns. function accomodates open-response column, get correct denominator respondents skipped check variables written something . passing offered choices implicit rejection , \"missing.\" text variable throw warning - may okay - recoded binary 1/0 variable indicating response. text variable assigned label \"\". Consider preserving original respondent text values prior point separate column needed. check_all_recode() prepares data.frame call sister function check_all_count(). label attribute accessed function.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"","code":"check_all_recode(dat, ..., set_labels = TRUE)"},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"dat data.frame survey data ... unquoted variable names containing answer choices. Can specified range, .e., q1_1:q1_5 using helper functions dplyr::select(). set_labels label attribute columns -written column text? Allow TRUE unless currently label attributes wish overwrite.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"Returns original data.frame specified column range updated, label attributes questions.","code":""},{"path":"https://tntp.github.io/tntpr/reference/check_all_recode.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Process a range of check-all-that-apply response columns for correct tabulation. — check_all_recode","text":"","code":"x <- data.frame( # 4th person didn't respond at all unrelated = 1:5, q1_1 = c(\"a\", \"a\", \"a\", NA, NA), q1_2 = c(\"b\", \"b\", NA, NA, NA), q1_3 = c(NA, NA, \"c\", NA, NA), q1_other = c(NA, \"something else\", NA, NA, \"not any of these\") ) library(dplyr) # for the %>% pipe x %>% check_all_recode(q1_1:q1_other) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> unrelated q1_1 q1_2 q1_3 q1_other #> 1 1 1 1 0 0 #> 2 2 1 1 0 1 #> 3 3 1 0 1 0 #> 4 4 NA NA NA NA #> 5 5 0 0 0 1 # You can use any of the dplyr::select() helpers to identify the columns: x %>% check_all_recode(contains(\"q1\")) #> Warning: column 4 has multiple values besides NA; not sure which is the question text. Guessing this an \"Other (please specify)\" column. #> unrelated q1_1 q1_2 q1_3 q1_other #> 1 1 1 1 0 0 #> 2 2 1 1 0 1 #> 3 3 1 0 1 0 #> 4 4 NA NA NA NA #> 5 5 0 0 0 1"},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Choose a text color given a background color — choose_text_color","title":"Choose a text color given a background color — choose_text_color","text":"Choose text color given background color","code":""},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Choose a text color given a background color — choose_text_color","text":"","code":"choose_text_color(bg_color)"},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Choose a text color given a background color — choose_text_color","text":"bg_color color","code":""},{"path":"https://tntp.github.io/tntpr/reference/choose_text_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Choose a text color given a background color — choose_text_color","text":"\"black\" \"white\"","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP colors — colors_tntp","title":"TNTP colors — colors_tntp","text":"list colors superseded new brand colors new function tntp_colors().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP colors — colors_tntp","text":"","code":"colors_tntp"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"TNTP colors — colors_tntp","text":"object class character length 34.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP colors — colors_tntp","text":"","code":"if (FALSE) { tntp_colors() }"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":null,"dir":"Reference","previous_headings":"","what":"Likert pallette — colors_tntp_likert","title":"Likert pallette — colors_tntp_likert","text":"likert palette superseded new brand colors new function tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Likert pallette — colors_tntp_likert","text":"","code":"colors_tntp_likert"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Likert pallette — colors_tntp_likert","text":"object class character length 7.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Likert pallette — colors_tntp_likert","text":"","code":"if (FALSE) { tntp_palette('likert_6') }"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":null,"dir":"Reference","previous_headings":"","what":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"likert palette superseded new brand colors new functions tntp_colors() tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"","code":"colors_tntp_likert_orange_to_green"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"object class character length 7.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_likert_orange_to_green.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Likert orange to green pallette — colors_tntp_likert_orange_to_green","text":"","code":"if (FALSE) { tntp_palette('bg_6') }"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP pallette — colors_tntp_palette","title":"TNTP pallette — colors_tntp_palette","text":"list colors superseded new brand colors new function tntp_colors().","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP pallette — colors_tntp_palette","text":"","code":"colors_tntp_palette"},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"TNTP pallette — colors_tntp_palette","text":"object class character length 16.","code":""},{"path":"https://tntp.github.io/tntpr/reference/colors_tntp_palette.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP pallette — colors_tntp_palette","text":"","code":"if (FALSE) { tntp_colors() }"},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert a date value into its school year. — date_to_sy","title":"Convert a date value into its school year. — date_to_sy","text":"Checks see date past user-specified cutoff point delineating school years, maps appropriate year.","code":""},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert a date value into its school year. — date_to_sy","text":"","code":"date_to_sy(date_var, last_day_of_sy = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert a date value into its school year. — date_to_sy","text":"date_var date convert. Can Date object string form 'YYYY-MM-DD' 'MM/DD/YYYY' last_day_of_sy cutoff date, date considered part following school year. year argument matter. Defaults (noisily) July 1st.","code":""},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert a date value into its school year. — date_to_sy","text":"Returns character vector format \"2013 - 2014\"","code":""},{"path":"https://tntp.github.io/tntpr/reference/date_to_sy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert a date value into its school year. — date_to_sy","text":"","code":"date_to_sy(as.Date(\"2014-05-05\"), as.Date(\"2000-07-01\")) #> [1] \"2013 - 2014\" date_to_sy(as.Date(\"2014-07-05\"), as.Date(\"2000-07-01\")) #> [1] \"2014 - 2015\""},{"path":"https://tntp.github.io/tntpr/reference/dot-onAttach.html","id":null,"dir":"Reference","previous_headings":"","what":"Title — .onAttach","title":"Title — .onAttach","text":"Title","code":""},{"path":"https://tntp.github.io/tntpr/reference/dot-onAttach.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Title — .onAttach","text":"","code":".onAttach(libname, pkgname)"},{"path":"https://tntp.github.io/tntpr/reference/dot-onAttach.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Title — .onAttach","text":"libname library name pkgname package name","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"function examines column data.frame; finds column composed solely values provided lvls argument updates factor variables, levels order provided. alternative calling dplyr::mutate_at factor() identifying specific variables want transform, several repeated sets responses.","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"","code":"factorize_df(dat, lvls, ignore.case = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"dat data.frame factor variables stored characters. lvls factor levels variable(s), order. question whose possible responses subset another question's, use function; manipulate specific columns dplyr::mutate_at. ignore.case Logical. TRUE, match without checking case, using capitalization lvls parameter final output. provided, function provide warning detects columns match without checking case coerce .","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"data.frame factorization completed place.","code":""},{"path":"https://tntp.github.io/tntpr/reference/factorize_df.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert all character vectors containing a set of values in a data.frame to factors. — factorize_df","text":"","code":"teacher_survey |> factorize_df(lvls = c(\"Strongly Disagree\", \"Disagree\", \"Somewhat Disagree\", \"Somewhat Agree\", \"Agree\", \"Strongly Agree\")) #> ℹ Changed the following columns to factors: `It's fair to expect students in #> this class to master these standards by the end of the year.`, `One year is #> enough time for students in this class to master these standards.`, `All #> students in my class can master the grade-level standards by the end of the #> year.`, and `The standards are appropriate for the students in this class.` #> # A tibble: 20 × 5 #> timing It's fair to expect st…¹ One year is enough t…² All students in my c…³ #> #> 1 Pre Disagree Disagree Agree #> 2 Pre Disagree Somewhat Agree Agree #> 3 Pre Somewhat Disagree Somewhat Disagree Strongly Agree #> 4 Pre Disagree Strongly Disagree Strongly Agree #> 5 Pre Agree Somewhat Disagree Strongly Disagree #> 6 Pre Strongly Disagree Somewhat Agree Somewhat Disagree #> 7 Pre Agree Strongly Agree Strongly Disagree #> 8 Pre Agree Disagree Somewhat Agree #> 9 Pre Strongly Disagree Disagree Somewhat Agree #> 10 Pre Somewhat Agree Somewhat Disagree Agree #> 11 Post Strongly Disagree Somewhat Agree Somewhat Disagree #> 12 Post Somewhat Agree Disagree Somewhat Disagree #> 13 Post Somewhat Disagree Somewhat Agree Strongly Disagree #> 14 Post Strongly Agree Strongly Agree Disagree #> 15 Post Strongly Agree Somewhat Disagree Strongly Disagree #> 16 Post Disagree Disagree Agree #> 17 Post Strongly Agree Agree Agree #> 18 Post Strongly Agree Strongly Agree Disagree #> 19 Post Somewhat Disagree Somewhat Agree Agree #> 20 Post Somewhat Agree Strongly Agree Strongly Disagree #> # ℹ abbreviated names: #> # ¹​`It's fair to expect students in this class to master these standards by the end of the year.`, #> # ²​`One year is enough time for students in this class to master these standards.`, #> # ³​`All students in my class can master the grade-level standards by the end of the year.` #> # ℹ 1 more variable: #> # `The standards are appropriate for the students in this class.` # prints warning due to case mismatches: teacher_survey |> factorize_df(lvls = c(\"Strongly disagree\", \"Disagree\", \"Somewhat disagree\", \"Somewhat agree\", \"Agree\", \"Strongly agree\")) #> Warning: ! Columns `It's fair to expect students in this class to master these standards #> by the end of the year.`, `One year is enough time for students in this class #> to master these standards.`, `All students in my class can master the #> grade-level standards by the end of the year.`, and `The standards are #> appropriate for the students in this class.` were NOT matched, but would #> match if `ignore.case` was set to \"TRUE\" #> Warning: ! No columns matched. Check spelling & capitalization of your levels. #> # A tibble: 20 × 5 #> timing It's fair to expect st…¹ One year is enough t…² All students in my c…³ #> #> 1 Pre Disagree Disagree Agree #> 2 Pre Disagree Somewhat Agree Agree #> 3 Pre Somewhat Disagree Somewhat Disagree Strongly Agree #> 4 Pre Disagree Strongly Disagree Strongly Agree #> 5 Pre Agree Somewhat Disagree Strongly Disagree #> 6 Pre Strongly Disagree Somewhat Agree Somewhat Disagree #> 7 Pre Agree Strongly Agree Strongly Disagree #> 8 Pre Agree Disagree Somewhat Agree #> 9 Pre Strongly Disagree Disagree Somewhat Agree #> 10 Pre Somewhat Agree Somewhat Disagree Agree #> 11 Post Strongly Disagree Somewhat Agree Somewhat Disagree #> 12 Post Somewhat Agree Disagree Somewhat Disagree #> 13 Post Somewhat Disagree Somewhat Agree Strongly Disagree #> 14 Post Strongly Agree Strongly Agree Disagree #> 15 Post Strongly Agree Somewhat Disagree Strongly Disagree #> 16 Post Disagree Disagree Agree #> 17 Post Strongly Agree Agree Agree #> 18 Post Strongly Agree Strongly Agree Disagree #> 19 Post Somewhat Disagree Somewhat Agree Agree #> 20 Post Somewhat Agree Strongly Agree Strongly Disagree #> # ℹ abbreviated names: #> # ¹​`It's fair to expect students in this class to master these standards by the end of the year.`, #> # ²​`One year is enough time for students in this class to master these standards.`, #> # ³​`All students in my class can master the grade-level standards by the end of the year.` #> # ℹ 1 more variable: #> # `The standards are appropriate for the students in this class.` "},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":null,"dir":"Reference","previous_headings":"","what":"Fake teacher roster dataset from OpenSDP — fake_county","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"Fake County synthetic panel dataset contains approximately 40,000 records comprising four years data roughly 10,000 teachers per year. dataset includes information teacher demographics, teaching assignments, salary, credentials, experience, evaluation scores, hiring retention status. also includes information school types average student characteristics school. real teachers dataset, based real data. Fake County developed offshoot Strategic Data Project's work human capital diagnostics school districts state education departments, can used teaching collaboration. data synthesized using R synthpop package.","code":""},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"","code":"fake_county"},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"data frame 39,339 rows 38 variables: tid double: Teacher ID fake_data double: Record Simulated school_year double: School Year school_code double: School Code school_name character: School Name t_male double: Teacher Male t_race_ethnicity double: Teacher Race/Ethnicity t_job_area double: Teacher Assignment Type t_salary double: Monthly Salary t_nbpts double: Teacher National Board Certification t_tenured double: Teacher Tenured t_experience double: Years Teaching Experience t_fte double: Teacher's FTE Status t_highest_degree double: Teacher's Highest Degree t_licensed_stem double: Teacher Licensed STEM Field t_eval_obs double: Evaluation Summary Observation Score t_eval_growth double: Evaluation Summary Student Growth Score t_stay double: Teacher School Following Year t_transfer double: Teacher Different School Following Year t_leave double: Teacher Teaching Fake County Schools Following Year t_novice double: Teacher Novice First-Year Teacher t_new_hire double: Teacher Teach Fake County Prior Year sch_elem double: School Elementary School sch_middle double: School Middle School sch_high double: School High School sch_alternative double: School Alternative School sch_regular double: School Regular School sch_title_1 double: School Title 1 School sch_magnet double: School Magnet School sch_vocational double: School Vocational School sch_region double: School Region Code sch_calendar_type double: School Calendar Type sch_iep_pct double: School Special Education Student Share 2012-15 sch_minority_pct double: School Minority Student Share 2012-15 sch_frpl_pct double: School Free Reduced Price Lunch Student Share 2012-15 sch_ela_avg double: School ELA Test Score Average 2012-15 (standard deviations) sch_math_avg double: School Math Test Score Average 2012-15 (standard deviations) sch_enroll_2015 double: School Enrollment 2015","code":""},{"path":"https://tntp.github.io/tntpr/reference/fake_county.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Fake teacher roster dataset from OpenSDP — fake_county","text":"https://github.com/OpenSDP/fake-county, posted Creative Commons license.","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":null,"dir":"Reference","previous_headings":"","what":"Create sequential figure numbers — figureN","title":"Create sequential figure numbers — figureN","text":"Create sequential figure numbers","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create sequential figure numbers — figureN","text":"","code":"figureN(x)"},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create sequential figure numbers — figureN","text":"x character string description figure","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create sequential figure numbers — figureN","text":"nothing","code":""},{"path":"https://tntp.github.io/tntpr/reference/figureN.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create sequential figure numbers — figureN","text":"","code":"# not run, in RMarkdown doc: `r figureN(\"Distribution of cars by cylinder count\")` #"},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks if a font family is usable and returns a usable font if not — get_usable_family","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"Helper function. Checks given family value available, returns default font family (\"sans\" user provided)","code":""},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"","code":"get_usable_family(family, silent = FALSE, default_family = \"sans\")"},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"family font family check character silent logical. TRUE raise warning font family unavailable default_family defaults \"sans\", can set another fallback family.","code":""},{"path":"https://tntp.github.io/tntpr/reference/get_usable_family.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks if a font family is usable and returns a usable font if not — get_usable_family","text":"character usable font family","code":""},{"path":"https://tntp.github.io/tntpr/reference/header_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"Insert header_script_tntp. — header_tntp","title":"Insert header_script_tntp. — header_tntp","text":"Call function insert header 'TNTP R Shell.R'.","code":""},{"path":"https://tntp.github.io/tntpr/reference/header_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Insert header_script_tntp. — header_tntp","text":"","code":"header_tntp()"},{"path":"https://tntp.github.io/tntpr/reference/import_segoe_ui.html","id":null,"dir":"Reference","previous_headings":"","what":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","title":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","text":"option tntpr.loadfonts -- set TRUE -- call extrafont::loadfonts() register non-core fonts R PDF & PostScript devices. running Windows, package calls function register non-core fonts Windows graphics device.","code":""},{"path":"https://tntp.github.io/tntpr/reference/import_segoe_ui.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","text":"","code":"import_segoe_ui()"},{"path":"https://tntp.github.io/tntpr/reference/import_segoe_ui.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Import Segoe UI Condensed font for use in charts — import_segoe_ui","text":"take care ensuring PDF/PostScript usage. location font directory displayed base import complete. highly recommended install system way font wish use programs.","code":""},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":null,"dir":"Reference","previous_headings":"","what":"Validate color inputs — is_color","title":"Validate color inputs — is_color","text":"Validate color inputs","code":""},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Validate color inputs — is_color","text":"","code":"is_color(x)"},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Validate color inputs — is_color","text":"x color","code":""},{"path":"https://tntp.github.io/tntpr/reference/is_color.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Validate color inputs — is_color","text":"TRUE x can interpreted color","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert all labelled-class columns to factors. — labelled_to_factors","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"Deprecated. Use as_factor() function haven package instead functionality. Takes data.frame, checks columns class labelled haven package, converts factor class.","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"","code":"labelled_to_factors(labels_df)"},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"labels_df data.frame containing columns class labelled","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"Returns data.frame.","code":""},{"path":"https://tntp.github.io/tntpr/reference/labelled_to_factors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert all labelled-class columns to factors. — labelled_to_factors","text":"","code":"tntpr::fake_county |> haven::as_factor() #> # A tibble: 39,339 × 38 #> tid fake_data school_year school_code school_name t_male t_race_ethnicity #> #> 1 100001 1 2014 1303122 Birch Middle Male African American #> 2 100001 1 2015 1303122 Birch Middle Male African American #> 3 100002 1 2012 1301958 Kingside Hi… Female White #> 4 100002 1 2013 1301958 Kingside Hi… Female White #> 5 100002 1 2014 1301958 Kingside Hi… Female White #> 6 100002 1 2015 1301958 Kingside Hi… Female White #> 7 100003 1 2012 1301575 Eliot Eleme… Female White #> 8 100003 1 2013 1301575 Eliot Eleme… Female White #> 9 100003 1 2014 1301575 Eliot Eleme… Female White #> 10 100004 1 2012 1300549 Junction Hi… Male White #> # ℹ 39,329 more rows #> # ℹ 31 more variables: t_job_area , t_salary , t_nbpts , #> # t_tenured , t_experience , t_fte , t_highest_degree , #> # t_licensed_stem , t_eval_obs , t_eval_growth , t_stay , #> # t_transfer , t_leave , t_novice , t_new_hire , #> # sch_elem , sch_middle , sch_high , sch_alternative , #> # sch_regular , sch_title_1 , sch_magnet , …"},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":null,"dir":"Reference","previous_headings":"","what":"Pallette names — palette_names","title":"Pallette names — palette_names","text":"list palette names superseded new brand colors new functions tntp_colors() tntp_palette(). see new brand palettes, use show_tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pallette names — palette_names","text":"","code":"palette_names"},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Pallette names — palette_names","text":"object class character length 7.","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_names.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pallette names — palette_names","text":"","code":"if (FALSE) { show_tntp_palette() }"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP branded color palettes — palette_tntp","title":"TNTP branded color palettes — palette_tntp","text":"function superseded tntp_colors() improved functionality includes recent TNTP brand colors. function creates user defined color palette combinations eleven colors. nine TNTP approved colors: dark_blue, medium_blue, light_blue, green, orange, gold, dark_grey (dark_gray), medium_grey (medium_gray), light_grey (light_gray). White black also available.","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP branded color palettes — palette_tntp","text":"","code":"palette_tntp(...)"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP branded color palettes — palette_tntp","text":"... supply quoted color names include color palette","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP branded color palettes — palette_tntp","text":"","code":"library(ggplot2) pal1_tntp <- tntp_colors(\"green\", \"gold\", \"orange\") pal2_tntp <- tntp_colors(\"navy\", \"cerulean\", \"sky\") p <- ggplot(mtcars, aes(wt, mpg)) p <- p + geom_point(aes(colour = factor(cyl))) p # Change colors to created palette p <- p + scale_color_manual(values = pal1_tntp) p g <- ggplot(mtcars, aes(factor(cyl), mean(mpg))) g <- g + geom_bar(aes(fill = factor(cyl)), stat = \"identity\") g # Change fill to created palette g <- g + scale_fill_manual(values = pal2_tntp) g"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp_scales.html","id":null,"dir":"Reference","previous_headings":"","what":"scale_palette_tntp — palette_tntp_scales","title":"scale_palette_tntp — palette_tntp_scales","text":"function superseded tntp_palette() includes new brand colors.","code":""},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp_scales.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"scale_palette_tntp — palette_tntp_scales","text":"","code":"palette_tntp_scales(palette = palette_names)"},{"path":"https://tntp.github.io/tntpr/reference/palette_tntp_scales.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"scale_palette_tntp — palette_tntp_scales","text":"palette palette","code":""},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":null,"dir":"Reference","previous_headings":"","what":"Attempt to parse a date with common formats — parse_date","title":"Attempt to parse a date with common formats — parse_date","text":"Helper function date_to_sy. Returns date object , noisily attempts parse string form YYYY-MM-DD MM/DD/YYYY. date parsed, throws error.","code":""},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Attempt to parse a date with common formats — parse_date","text":"","code":"parse_date(date)"},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Attempt to parse a date with common formats — parse_date","text":"date character Date vector parse","code":""},{"path":"https://tntp.github.io/tntpr/reference/parse_date.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Attempt to parse a date with common formats — parse_date","text":"Date vector","code":""},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"Calculate percent non-missing values character vector containing values interest. helper function factorize_df().","code":""},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"","code":"prop_matching(vec, valid_strings, ignore.case = FALSE)"},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"vec character vector. valid_strings values variable can possibly take . ignore.case TRUE, ignores case matching","code":""},{"path":"https://tntp.github.io/tntpr/reference/prop_matching.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df(). — prop_matching","text":"numeric proportion 0 1.","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":null,"dir":"Reference","previous_headings":"","what":"Recode a variable into binary groups, e.g., ","title":"Recode a variable into binary groups, e.g., ","text":"Recodes character variable binary result, two-level factor. values matching supplied character strings to_match vector coded first level factor; values coded level. NA remains NA. default factor labels \"Selected\" \"selected\" can overridden. recoding case-sensitive; specify \"agree\" top-2 value, \"Agree\" counted Top-2, vice versa.","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Recode a variable into binary groups, e.g., ","text":"","code":"recode_to_binary( x, to_match = c(\"strongly agree\", \"agree\"), label_matched = \"Selected\", label_unmatched = \"Not selected\" )"},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Recode a variable into binary groups, e.g., ","text":"x character factor vector recoded to_match character vector strings put first level factor. Defaults \"strongly agree\" \"agree\" can overwritten. label_matched factor label values match strings specified to_match? Defaults \"Selected\" label_unmatched factor label values match strings specified to_match? Defaults \"selected\".","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Recode a variable into binary groups, e.g., ","text":"factor variable (nicer ordering calls janitor::tabyl) values mapped two levels.","code":""},{"path":"https://tntp.github.io/tntpr/reference/recode_to_binary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Recode a variable into binary groups, e.g., ","text":"","code":"agreement <- c( \"Strongly agree\", \"Agree\", \"Somewhat agree\", \"Somewhat disagree\", \"Strongly disagree\", \"Frogs\", NA ) recode_to_binary(agreement) # default values of \"strongly agree\" and \"agree\" are used for recoding #> [1] Selected Selected Not selected Not selected Not selected #> [6] Not selected #> Levels: Selected Not selected recode_to_binary(agreement, label_matched = \"Top-2 Agree\", label_unmatched = \"Not in Top-2\" ) # custom labels of factor levels #> [1] Top-2 Agree Top-2 Agree Not in Top-2 Not in Top-2 Not in Top-2 #> [6] Not in Top-2 #> Levels: Top-2 Agree Not in Top-2 recode_to_binary(agreement, \"frogs\") #> [1] Not selected Not selected Not selected Not selected Not selected #> [6] Selected #> Levels: Selected Not selected recode_to_binary( agreement, \"frogs\", \"FROGS!!!\", \"not frogs\" ) # custom matching values & labels of factor levels #> [1] not frogs not frogs not frogs not frogs not frogs FROGS!!! #> Levels: FROGS!!! not frogs freq <- c(\"always\", \"often\", \"sometimes\", \"never\") recode_to_binary(freq, \"always\", \"always\", \"less than always\") #> [1] always less than always less than always less than always #> Levels: always less than always"},{"path":"https://tntp.github.io/tntpr/reference/scale_colour_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","title":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","text":"function deprecated. Please use scale_color_manual(values = tntp_palette(palette_name)) instead","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_colour_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","text":"","code":"scale_colour_tntp(palette = palette_names, drop = FALSE, ...) scale_color_tntp(palette = palette_names, drop = FALSE, ...)"},{"path":"https://tntp.github.io/tntpr/reference/scale_colour_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"scale_colour_tntp/scale_color_tntp — scale_colour_tntp","text":"palette character string describing desired palette drop drop ... arguments pass ggplot2::discrete_scale()","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"scale_fill_tntp — scale_fill_tntp","title":"scale_fill_tntp — scale_fill_tntp","text":"function deprecated. Please use scale_fill_manual(values = tntp_palette(palette_name)) instead","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"scale_fill_tntp — scale_fill_tntp","text":"","code":"scale_fill_tntp(palette = palette_names, drop = FALSE, ...)"},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"scale_fill_tntp — scale_fill_tntp","text":"palette One : \"default\", \"likert_4pt\", \"likert_5pt\", \"likert_6pt\", \"colors_tntp_old\" drop drop ... additional arguments passed ggplot2::discrete_scale()","code":""},{"path":"https://tntp.github.io/tntpr/reference/scale_fill_tntp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"scale_fill_tntp — scale_fill_tntp","text":"","code":"library(ggplot2) library(dplyr) x <- mtcars %>% count(cyl, am) %>% mutate(am = as.factor(am)) ggplot(x, aes(x = cyl, y = n, fill = am)) + # you need a fill aesthetic geom_col() + scale_fill_manual(values = tntp_palette())"},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":null,"dir":"Reference","previous_headings":"","what":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"internal function calls standard formatting options Data Memo RMarkdown template moved keep actual memo template cleaner easier use","code":""},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"","code":"set_data_memo_formatting()"},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"nothing","code":""},{"path":"https://tntp.github.io/tntpr/reference/set_data_memo_formatting.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set the formatting options for a TNTP Data Memo — set_data_memo_formatting","text":"","code":"# not run: set_data_memo_formatting()"},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"Create new repository Bitbucket, set working directory folder run function. set main repo folder well single subfolder can work immediate project. must specify subfolder name well long name associated project analyst(s) working . latter two values used create README.Md file.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"","code":"setup_repo(subfolder, proj_name, analyst_name)"},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"subfolder character vector containing concise name project subfolder. E.g., repository name city \"Anywhere City\", project subfolder might \"ela_access\" \"aps_talent_landscape\"). proj_name longer, full name subfolder project. appear subfolder's README.md file. E.g., \"Access Grade-Level ELA Content Pilot.\" analyst_name name(s) analysts currently working subfolder project. appear subfolder's README.md file.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_repo.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize a new repository, and a single subfolder, TNTP style. — setup_repo","text":"","code":"# After the user has created a repository \"Anywhere City\" and set their working # directory to that folder: ## not run # setup_repo(\"ela_access\", # \"Access to Grade-Level ELA Content\", # \"Dustin Pashouwer and Sam Firke\")"},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":null,"dir":"Reference","previous_headings":"","what":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"repository might represent region, like \"Anywhere City\", major client contract, like \"Midwestern Charter Network. Within repo subfolder analysis project. function creates subfolder populates folders README. use: within existing repository Bitbucket, set working directory folder run function create sub-folder. Use setup_repo() blank new repository add first project subfolder create RProject .gitignore files. Add subsequent analysis project folders function.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"","code":"setup_subdirectory(subfolder, proj_name, analyst_name)"},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"subfolder character vector containing concise name project subfolder. E.g., repository name city \"Anywhere City\", project subfolder might \"ela_access\" \"aps_talent_landscape\"). proj_name longer, full name subfolder project. appear subfolder's README.md file. analyst_name name(s) analysts currently working subfolder project. appear subfolder's README.md file.","code":""},{"path":"https://tntp.github.io/tntpr/reference/setup_subdirectory.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Initialize a new subdirectory in an existing repository, TNTP style. — setup_subdirectory","text":"","code":"# When there's already a repository \"Anywhere City\" with an RProject and a .gitignore # and a new project analysis subfolder is needed within that repo: ## not run # setup_subdirectory(\"ela_access\", # \"Equitable Access to Grade-Level ELA\", # \"Dustin Pashouwer and Sam Firke\")"},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":null,"dir":"Reference","previous_headings":"","what":"Write datatable to temp excel file and open it. — show_in_excel","title":"Write datatable to temp excel file and open it. — show_in_excel","text":"Write datatable temp excel file open .","code":""},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Write datatable to temp excel file and open it. — show_in_excel","text":"","code":"show_in_excel(.data)"},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Write datatable to temp excel file and open it. — show_in_excel","text":".data Dataframe","code":""},{"path":"https://tntp.github.io/tntpr/reference/show_in_excel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Write datatable to temp excel file and open it. — show_in_excel","text":"Returns data.frame.","code":""},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":null,"dir":"Reference","previous_headings":"","what":"Update case of a character vector — standardize_case","title":"Update case of a character vector — standardize_case","text":"Helper function factorize_df(). Returns vector length vec, values match values valid_strings updated case valid_strings","code":""},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update case of a character vector — standardize_case","text":"","code":"standardize_case(vec, new_case)"},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update case of a character vector — standardize_case","text":"vec character vector want update new_case character vector correctly cased strings","code":""},{"path":"https://tntp.github.io/tntpr/reference/standardize_case.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Update case of a character vector — standardize_case","text":"character vector length vec","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":null,"dir":"Reference","previous_headings":"","what":"Create sequential table numbers — tableN","title":"Create sequential table numbers — tableN","text":"Create sequential table numbers","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create sequential table numbers — tableN","text":"","code":"tableN(x)"},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create sequential table numbers — tableN","text":"x character string description figure","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create sequential table numbers — tableN","text":"nothing","code":""},{"path":"https://tntp.github.io/tntpr/reference/tableN.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create sequential table numbers — tableN","text":"","code":"# not run, in RMarkdown doc: `r tableN(\"Distribution of cars by cylinder count\")`"},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":null,"dir":"Reference","previous_headings":"","what":"Teacher survey data — teacher_survey","title":"Teacher survey data — teacher_survey","text":"Simulated teacher survey data. Data includes teh four TNTP high expectations questions.","code":""},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Teacher survey data — teacher_survey","text":"","code":"teacher_survey"},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Teacher survey data — teacher_survey","text":"## `teacher survey` data frame 5 columns 20 rows. five columns `timing` column, followed four column four high expectations questions. Responses 'strongly agree' strongly disagree' 6-point scale.","code":""},{"path":"https://tntp.github.io/tntpr/reference/teacher_survey.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Teacher survey data — teacher_survey","text":"simulated `data-raw/teacher_survey.R`","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP's ggplot2 theme — theme_tntp","title":"TNTP's ggplot2 theme — theme_tntp","text":"theme superseded [tntp_style()]. Ggplot2 theme customized TNTP aesthetics","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP's ggplot2 theme — theme_tntp","text":"","code":"theme_tntp( show_legend_title = TRUE, base_size = 12, base_family = \"Segoe UI\", grid_color = \"grey93\", title_align = \"center\", title_color = \"black\", title_size = 12, subtitle_align = \"center\", subtitle_color = \"black\", subtitle_size = 12, caption_align = \"right\", caption_color = \"black\", caption_size = 12 )"},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP's ggplot2 theme — theme_tntp","text":"show_legend_title logical. legend title shown? Leave TRUE want change legend title subsequent line + labs(...). base_size base font size base_family base font family grid_color color major gridlines title_align alignment main title, defaults \"center\"; also accepts \"left\" \"right\" title_color color title text title_size size title text subtitle_align alignment sub-title, defaults \"center\"; also accepts \"left\" \"right\" subtitle_color color subtitle text subtitle_size size subtitle text caption_align alignment caption, defaults \"right\"; also accepts \"left\" \"center\" caption_color color caption text caption_size size caption text","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":null,"dir":"Reference","previous_headings":"","what":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"theme superseded tntp_style().","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"","code":"theme_tntp_2018( base_family = \"Segoe UI\", base_size = 11.5, plot_title_family = base_family, plot_title_size = 18, plot_title_face = \"bold\", plot_title_margin = 10, subtitle_family = base_family, subtitle_size = 12, subtitle_face = \"plain\", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = \"plain\", caption_family = base_family, caption_size = 9, caption_face = \"italic\", caption_margin = 10, axis_text = TRUE, axis_text_size = base_size, axis_title_family = subtitle_family, axis_title_size = 9, axis_title_face = \"plain\", axis_title_just = \"rt\", plot_margin = ggplot2::margin(30, 30, 30, 30), grid_col = \"grey93\", grid = TRUE, axis_col = \"#cccccc\", axis = FALSE, ticks = FALSE )"},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"base_family, base_size base font family size plot_title_family, plot_title_face, plot_title_size, plot_title_margin plot title family, face, size margi subtitle_family, subtitle_face, subtitle_size plot subtitle family, face size subtitle_margin plot subtitle margin bottom (single numeric value) strip_text_family, strip_text_face, strip_text_size facet label font family, face size caption_family, caption_face, caption_size, caption_margin plot caption family, face, size margin axis_text add x y axes text? X, Y axis_text_size font size axis text axis_title_family, axis_title_face, axis_title_size axis title font family, face size axis_title_just axis title font justification, one [blmcrt] plot_margin plot margin (specify ggplot2::margin()) grid_col, axis_col grid & axis colors; default #cccccc grid panel grid (TRUE, FALSE, combination X, x, Y, y) axis add x y axes? TRUE, FALSE, \"xy\" ticks ticks TRUE add ticks","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"building-upon-theme-tntp","dir":"Reference","previous_headings":"","what":"Building upon theme_tntp","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"function setup way can customize one just wrapping call changing parameters. See source examples.","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"gotchas","dir":"Reference","previous_headings":"","what":"Gotchas","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"distinctions font names various devices. Names work display graphics devices bitmap ones png may work well PostScript PDF ones. may need two versions font-based theme function work particular situation. situation usually arises using newer font many weights somewhat irregular internal font name patterns. option hrbrthemes.loadfonts -- set TRUE -- call extrafont::loadfonts() register non-core fonts R PDF & PostScript devices. running Windows, package calls function register non-core fonts Windows graphics device.","code":""},{"path":"https://tntp.github.io/tntpr/reference/theme_tntp_2018.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography — theme_tntp_2018","text":"","code":"if (FALSE) { library(ggplot2) library(dplyr) # seminal scatterplot ggplot(mtcars, aes(mpg, wt)) + geom_point() + labs( x = \"Fuel effiiency (mpg)\", y = \"Weight (tons)\", title = \"Seminal ggplot2 scatterplot example\", subtitle = \"A plot that is only useful for demonstration purposes\", caption = \"Brought to you by the letter 'g'\" ) + theme_ipsum() # seminal bar chart update_geom_font_defaults() count(mpg, class) %>% ggplot(aes(class, n)) + geom_col() + geom_text(aes(label = n), nudge_y = 3) + labs( x = \"Fuel efficiency (mpg)\", y = \"Weight (tons)\", title = \"Seminal ggplot2 bar chart example\", subtitle = \"A plot that is only useful for demonstration purposes\", caption = \"Brought to you by the letter 'g'\" ) + theme_ipsum(grid = \"Y\") + theme(axis.text.y = element_blank()) }"},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP Brand Colors — tntp_colors","title":"TNTP Brand Colors — tntp_colors","text":"Translate human friendly TNTP brand color names like \"medium_blue\" accurate hex values use plotting. function can also used show named vector available TNTP brand colors values. Use show_tntp_colors() quickly visualize selected colors plot window. often used palettes TNTP colors, see tntp_palette().","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP Brand Colors — tntp_colors","text":"","code":"tntp_colors(...) show_tntp_colors( ..., pattern = NULL, labels = TRUE, borders = NULL, cex_label = 1, ncol = NULL )"},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP Brand Colors — tntp_colors","text":"... Supply quoted TNTP color names return. colors specified, returns available colors. pattern Optional regular expression. provided, return brand colors match regular expression labels Logical. Label colors names hex values? borders Border color tile. Default uses par(\"fg\"). Use border = NA omit borders. cex_label Size printed labels, multiplier default size. ncol Number columns. supplied, tries square possible.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_colors.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP Brand Colors — tntp_colors","text":"","code":"library(ggplot2) # Use tntp_colors() to retrieve a single color... ggplot(mtcars, aes(wt, mpg)) + geom_point(color = tntp_colors('green')) #... multiple colors ... ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + scale_color_manual(values = tntp_colors('green', 'navy', 'red')) #... or a list of all possible TNTP brand colors tntp_colors() #> mint|light_green gray|grey|light_gray|light_grey #> \"#E2EDDC\" \"#F1F1EE\" #> white black #> \"#FFFFFF\" \"#000000\" #> yellow|medium_yellow navy|blue #> \"#FDE57B\" \"#00355F\" #> pink|light_red red #> \"#FDDACA\" \"#C31F46\" #> green charcoal|dark_gray|dark_grey #> \"#317D5C\" \"#4A4A4A\" #> tangerine|orange salmon|medium_red #> \"#F26C4C\" \"#DA8988\" #> gold moss|medium_green #> \"#F2CF13\" \"#8FB09D\" #> sky|light_blue cerulean|medium_blue #> \"#81D3EB\" \"#00A5C7\" #> light_yellow medium_gray|medium_grey #> \"#FAEDB8\" \"#9E9E9C\" #> dark_gold dark_green #> \"#C2A60A\" \"#1D4935\" #> dark_red green_4 #> \"#7C132C\" \"#60977D\" #> green_2 blue_4 #> \"#B9CFBD\" \"#006D93\" #> blue_2 red_4 #> \"#41BCD9\" \"#CF5467\" #> red_2 yellow_4 #> \"#ECB2A9\" \"#F8DA47\" #> yellow_2 gray_4|grey_4 #> \"#FCE99A\" \"#747473\" #> gray_2|grey_2 #> \"#C7C7C5\" # Use show_tntp_colors() to quickly see brand colors in the plotting window show_tntp_colors('mint', 'moss', 'green') # You can also use a pattern to return similar colors show_tntp_colors(pattern = 'green') # You can see all colors (and names) by running it with no arguments show_tntp_colors()"},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":null,"dir":"Reference","previous_headings":"","what":"TNTP Credential Get/Set Command — tntp_cred","title":"TNTP Credential Get/Set Command — tntp_cred","text":"wrapper around keyring package secure credential management. tntp_cred() attempt get credential, credential found prompt add (return ). tntp_cred_set() set credential. default prompt overwriting current credentials. tntp_cred_list() list current credentials sorted service username.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"TNTP Credential Get/Set Command — tntp_cred","text":"","code":"tntp_cred(service, username = NULL, keyring = NULL, prompt = NULL) tntp_cred_set( service = NULL, username = NULL, keyring = NULL, prompt = NULL, overwrite = NULL ) tntp_cred_list(service = NULL, keyring = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"TNTP Credential Get/Set Command — tntp_cred","text":"service identifier credential pulling setting username OPTIONAL. Can used specify different usernames service keyring OPTIONAL. Can used specify specific keyring prompt OPTIONAL. text displayed input box key setting? overwrite OPTIONAL. default, tntp_cred_set() prompt finds credential already saved. Set TRUE overwrite without prompting FALSE throw error current credential found.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"TNTP Credential Get/Set Command — tntp_cred","text":"stored (newly created) credential","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_cred.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"TNTP Credential Get/Set Command — tntp_cred","text":"","code":"if (FALSE) { # Using tntp_cred() with qualtRics library(qualtRics) # If no credential is set, this command will prompt for it first qualtrics_token <- tntp_cred(\"QUALTRICS_TOKEN\") qualtrics_api_credentials(api_key = qualtrics_token, base_url = 'tntp.co1.qualtrics.com') # To overwrite your Qualtrics credential tntp_cred(\"QUALTRICS_TOKEN\", .set = TRUE) }"},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":null,"dir":"Reference","previous_headings":"","what":"Common TNTP Color Palettes — tntp_palette","title":"Common TNTP Color Palettes — tntp_palette","text":"Use see","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Common TNTP Color Palettes — tntp_palette","text":"","code":"tntp_palette(palette = \"likert_6\", reverse = FALSE) show_tntp_palette(..., reverse = FALSE, pattern = NULL)"},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Common TNTP Color Palettes — tntp_palette","text":"palette Name TNTP palette want use. see available palettes, use show_tntp_palette() reverse Logical. set TRUE, reverses direction palette. ... Supply quoted TNTP palette names visualize. names specified, shows available palettes. pattern Optional regular expression. provided, return palettes match regular expression","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_palette.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Common TNTP Color Palettes — tntp_palette","text":"","code":"library(ggplot2) # Use to add a common palette to a ggplot visualization ggplot(diamonds, aes(y = color, fill = cut)) + geom_bar(position = \"fill\") + scale_fill_manual(values = tntp_palette('blues', reverse = TRUE)) # Use show_tntp_palette() to visualize a single or multiple palettes show_tntp_palette('likert_7') show_tntp_palette('bg_5', 'likert_5') # You can use a pattern to show similar palettes show_tntp_palette(pattern = 'top2') show_tntp_palette(pattern = '_6') # Or run it with no specified palettes to see all available palettes show_tntp_palette() # For creating a continuous color palette, use scale_color_gradient() # along with tntp_colors(): ggplot(mtcars, aes(hp, disp, color = mpg)) + geom_point(size = 3) + scale_color_gradient(low = tntp_colors('red'), high = tntp_colors('green'))"},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Create TNTP themed ggplot2 charts — tntp_style","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"custom theme including TNTP fonts defaults styling ggplot2 charts.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"","code":"tntp_style( family = \"Halyard Display\", header_family = family, base_size = 28, text_color = \"#222222\", caption_color = \"#7D7E81\", show_legend_title = FALSE, show_axis_titles = FALSE, grid = FALSE, grid_color = \"#CBCBCB\", title_align = \"left\", legend_align = \"left\", caption_align = \"right\" )"},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"family Base font family. Defaults \"Halyard Display\". header_family Font family title subtitle. Defaults base font family. base_size Base font size. Recommended minimum value 15. text_color Text color titles, axes, legends, facets. caption_color Text color caption. show_legend_title Logical. legend title shown? Leave TRUE want change legend title subsequent line + labs(...). show_axis_titles axis titles shown? Use TRUE FALSE toggle titles, x y show just axis title. grid grid lines shown? Use TRUE FALSE toggle grid lines, string combination X, x, Y, y major minor x y grid lines. grid_color Grid line color. title_align, legend_align, caption_align Alignment title, legend, caption. Accepts left, right, center.","code":""},{"path":"https://tntp.github.io/tntpr/reference/tntp_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create TNTP themed ggplot2 charts — tntp_style","text":"","code":"if (FALSE) { library(tntpr) library(dplyr) library(ggplot2) fake_county |> filter(t_salary > 0) |> ggplot(aes(t_experience, t_salary)) + geom_point() + scale_y_continuous(labels = scales::dollar) + labs( title = \"Salary Increases with Experience\", subtitle = \"With significant variation at all levels\", x = \"Years of Experience\", caption = \"Data from the Fake County Data Set\" ) + tntp_style(show_axis_titles = \"x\") frpl_experience <- fake_county |> mutate(frpl_bucket = cut(sch_frpl_pct, breaks = c(0, 20, 40, 60, 80, 100), labels = c(\"0-20%\", \"20-40%\", \"40-60%\", \"60-80%\", \"80-100%\") )) |> group_by(frpl_bucket) |> summarize(avg_experience = mean(t_experience, na.rm = TRUE)) |> mutate( label = as.character(round(avg_experience, digits = 1)), label = if_else(frpl_bucket == \"0-20%\", paste0(label, \"\\nYears of\\nExperience\"), label) ) frpl_experience |> ggplot(aes(frpl_bucket, avg_experience)) + geom_col(fill = if_else(frpl_experience$frpl_bucket == \"60-80%\", tntp_colors(\"tangerine\"), tntp_colors(\"medium_gray\") )) + geom_text(aes(label = label), nudge_y = -0.25, vjust = 1, color = \"white\", size = 5, lineheight = 1, family = \"Segoe UI\" ) + labs( title = \"High Poverty Schools have Less Experienced Teachers\", x = \"% of Student Body Receiving Free/Reduced Lunch\" ) + scale_y_continuous(breaks = seq(0, 20, 4)) + tntp_style( base_size = 20, show_axis_titles = \"x\" ) }"},{"path":"https://tntp.github.io/tntpr/reference/tntpr.html","id":null,"dir":"Reference","previous_headings":"","what":"Data Analysis Tools Customized for TNTP — tntpr","title":"Data Analysis Tools Customized for TNTP — tntpr","text":"-house TNTP R package. Includes tools data manipulation, analysis, reporting, including making TNTP-themed charts documents. TNTP data-using staff, though available broader public.","code":""},{"path":[]},{"path":"https://tntp.github.io/tntpr/reference/update_geom_font_defaults.html","id":null,"dir":"Reference","previous_headings":"","what":"Update matching font defaults for text geoms — update_geom_font_defaults","title":"Update matching font defaults for text geoms — update_geom_font_defaults","text":"Updates [ggplot2::geom_label] [ggplot2::geom_text] font defaults","code":""},{"path":"https://tntp.github.io/tntpr/reference/update_geom_font_defaults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update matching font defaults for text geoms — update_geom_font_defaults","text":"","code":"update_geom_font_defaults( family = \"Segoe UI\", face = \"plain\", size = 3.5, color = \"#2b2b2b\" )"},{"path":"https://tntp.github.io/tntpr/reference/update_geom_font_defaults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update matching font defaults for text geoms — update_geom_font_defaults","text":"family, face, size, color font family name, face, size color","code":""},{"path":"https://tntp.github.io/tntpr/reference/update_tntpr.html","id":null,"dir":"Reference","previous_headings":"","what":"Re-install the tntpr package from GitHub. — update_tntpr","title":"Re-install the tntpr package from GitHub. — update_tntpr","text":"Re-install tntpr package GitHub.","code":""},{"path":"https://tntp.github.io/tntpr/reference/update_tntpr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Re-install the tntpr package from GitHub. — update_tntpr","text":"","code":"update_tntpr()"},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":null,"dir":"Reference","previous_headings":"","what":"Fake student data from the Wisconsin State Dept. of Ed — wisc","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"generated data set containing data 1200 imaginary individual K-12 students Wisconsin. nested within 6 schools 3 districts. adapting source, Sam switched school district variables (multiple districts per school) made minor changes, including dropping columns understand seem relevant (e.g., variables like \"luck\" used calculate reading math scores).","code":""},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"","code":"wisc"},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"data frame 2700 rows 26 variables: student_id numeric: student's unique ID # grade numeric: grade level district numeric: district code school numeric: school code white numeric: student white? black numeric: student black? hisp numeric: student Hispanic? indian numeric: student Native-American Indian? asian numeric: student Asian? econ numeric: student economically-disadvantaged? female numeric: student female? ell numeric: student English Language Learner? disab numeric: student learning disability? year numeric: school year attday numeric: days attended readSS numeric: student's reading standardized test score mathSS numeric: student's math standardized test score proflvl factor: student's proficiency level race factor: student's single-category race","code":""},{"path":"https://tntp.github.io/tntpr/reference/wisc.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Fake student data from the Wisconsin State Dept. of Ed — wisc","text":"https://github.com/jknowles/r_tutorial_ed/, posted Creative Commons license. script used generate data set , although well documented: https://github.com/jknowles/r_tutorial_ed/blob/master/data/simulate_data.R","code":""}]