turbokit: turbokit: Speedy and dynamic code input.

Description Details Setting up turbokit insert functions construct functions toggle_ functions

Description

The turbokit package provides several features to speed up inputting code and minimize redundant formatting tasks. Its main purposes is to aid the user in doing data science efficiently. To do this, turbokit introduces alternative input methods for functions in different packages, and has powerful chaining abilities.

Details

A core consideration of the package is that each user is unique and has their own preference and use case. For this reason, most functions' side effects are customizable, and several approaches are offered that result in the same output.

vignette("tidymath") vignette("superpipe")

Setting up turbokit

To get the most out of turbokit, the user should bind its core functions to shortcuts. This can be done by navigating from RStudio: Tools -> Addins -> Browse Addins -> Keyboard Shortcuts

Suggestion for bindings, for minimal hand travel distance and natural combinations.

Function Recommended Shortcut Description
construct_complex ctrl+shift+/ insert 1500+ functions
insert_pipe ctrl+shift+. insert pipe based on context
toggle_pipe ctrl+shift+, switch between pipes
toggle_mode ctrl+shift+right switch between shortcut modes
select ctrl+shift+s insert dplyr::select
filter ctrl+shift+f insert dplyr::filter
mutate ctrl+shift+m insert dplyr::mutate
summarise ctrl+shift+z insert dplyr::summarise
across ctrl+shift+a insert tiyselect::across
contains ctrl+shift+f insert tiyselect::across
starts_with ctrl+shift+1 insert tiyselect::across
ends_with ctrl+shift+2 insert tiyselect::across

This is a mere recommendation - users are highly encouraged to try out different setups that work for them.

insert functions

The insert functions insert a verb or operator in the R script at the current cursor location, and place the cursor between the function's brackets. The insert_ functions are designed to be called with shortcuts, allowing for rapid insertion of code.

construct functions

The construct functions are a family of insert functions of a certain package. Each function is formed by an abbreviation of snakecase initials. Construct functions describe most functions of a packages, bar those with identical initials, in which case the more popular one is implemented.

The construct_complex function is a wrapper for all other construct functions, and its shortcut bindings are dynamic. This means that the user can specify preferences, changing the shortcuts required to call functions from different packages. In other words, per user definition, the same shortcut combinations may yield different outputs, and this change can be tightly controled by the user.

toggle_ functions

The toggle_ function provides a shortcut to change package options, which changes the side effects of key turbokit functions.

  1. toggle_pipe

This function toggles between widely used pipe operators \ often called under the hood by several turbokit functions to switch between operators based on the document context. In effect, it greatly reduces the chance to input the wrong operator. This function is exported.

  1. toggle_mode

This function toggles between turbokit modes. A turbokit mode defines the output of the construct_complex function. Each mode comes with several predefined packages and shortcut abbreviations.


D-Se/turbokit documentation built on Dec. 17, 2021, 3:10 p.m.