Learn R Programming

tntpr

About

The tntpr package contains an assortment of functions and templates customized to meet the needs of data analysts at the non-profit organization TNTP. It includes functions for branded colors and plots, credentials management, repository set-up, and other common analytic tasks.

Package summary

Some of the highlights of the package include:

  • 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.).
  • The sp_*() functions for interacting with Sharepoint through 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
  • Wrappers for quickly making typical TNTP-style charts (e.g., bar chart of means on variable 1 grouped by variable 2)
  • Education-specific data management functions (e.g., date_to_sy() to convert continuous hire dates into school years using a specified cutoff date)
  • Built-in fake data sets to practice with, including student achievement data (wisc), teacher data (fake_county) and survey data (teacher_survey)

tntpr is built to work with the tidyverse set of packages.

Installing the tntpr package

You can install tntpr from CRAN as follows:

install.packages('tntpr')

You can also install this package from its GitHub repository using devtools. If you do not have the devtools package installed, you will have to run the first line in the code below as well:

# install.packages('devtools')
devtools::install_github('tntp/tntpr')

Once installed, you load it like any other package.

library(tntpr)

Feature Requests and Bug Reports

Have a data problem you think tntpr could help with? Find a bug while working with the tntpr package? Please create an issue.

Copy Link

Version

Install

install.packages('tntpr')

Monthly Downloads

173

Version

1.2.1

License

CC BY 4.0

Issues

Pull Requests

Stars

Forks

Maintainer

Dustin Pashouwer

Last Published

November 26th, 2024

Functions in tntpr (1.2.1)

date_to_sy

Convert a date value into its school year.
figureN

Create sequential figure numbers
.onAttach

Title
bar_chart_counts

Bar chart of counts with TNTP polish
check_all_recode

Process a range of check-all-that-apply response columns for correct tabulation.
choose_text_color

Get contrasting text colors for fills
get_ext

Pull extension from a path
colors_tntp_likert

Likert pallette
factorize_df

Convert all character vectors containing a set of values in a data.frame to factors.
fake_county

Fake teacher roster dataset from OpenSDP
palette_tntp_scales

scale_palette_tntp
parse_date

Attempt to parse a date with common formats
get_usable_family

Checks if a font family is usable and returns a usable font if not
palette_names

Pallette names
colors_tntp_likert_orange_to_green

Likert orange to green pallette
colors_tntp_palette

TNTP pallette
prop_matching

Calculate the percent of non-missing values in a character vector containing the values of interest. This is a helper function for factorize_df().
is_drive_id

Test if a string is formatted like a Sharepoint drive id
check_all_count

Tabulate a range of check-all-that-apply response columns in a single table.
is_site_id

Test if a string is formatted like a Sharepoint site id
palette_tntp

TNTP branded color palettes
tntp_style

Create TNTP themed ggplot2 charts
show_in_excel

Write Dataframe to a temp excel file and open it.
position_diverge

Easy Diverging Bar Charts
import_segoe_ui

Import Segoe UI Condensed font for use in charts
recode_to_binary

Recode a variable into binary groups, e.g., "Top-2" and "Not in Top-2".
sp_create_folder

Create Sharepoint Folder
process_type

Determine function type by extension and provided type Handles type validation
is_color

Validate color inputs
sp_defaults

Set default Sharepoint settings for a session
header_tntp

Insert header_script_tntp.
scale_colour_tntp

scale_color_tntp/scale_fill_tntp
is_site_url

Test if a string is formatted like a Sharepoint site url
set_data_memo_formatting

Set the formatting options for a TNTP Data Memo
sp_error

For parsing sharepoint errors (right now just path errors)
sp_site

Return Microsoft365R site or drive object
sp_list

List Sharepoint Contents
sp_check_folder

Check for existence of a Sharepoint folder and offer to create it if it doesn't exist
teacher_survey

Teacher survey data
tntpr

Data Analysis Tools Customized for TNTP
sp_upload

Sharepoint upload/download
labelled_to_factors

Convert all labelled-class columns to factors.
sp_read

Read/Write from Sharepoint
setup_repo

Initialize a new repository, and a single subfolder, TNTP style.
setup_subdirectory

Initialize a new subdirectory in an existing repository, TNTP style.
sp_string

Internal function to create cli-friendly site/drive/path string
sp_write_xlsx

Function for uploading an xls / xlsx file
standardize_case

Update case of a character vector
theme_tntp

TNTP's ggplot2 theme
wisc

Fake student data from the Wisconsin State Dept. of Ed
update_geom_font_defaults

Update matching font defaults for text geoms
tableN

Create sequential table numbers
update_tntpr

Re-install the tntpr package from GitHub.
sp_read_xlsx

Internal function for reading excel files from Sharepoint
tntp_cred

TNTP Credential Get/Set Command
tntp_palette

Common TNTP Color Palettes
theme_tntp_2018

A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography
tntp_colors

TNTP Brand Colors
colors_tntp

TNTP colors