Speed up your R programming workflow with RStudio addins and customized keyboard shortcuts Credit: Thinkstock If you want to speed up your R programming workflow, RStudio addins and custom keyboard shortcuts are definitely worth a look. A number of R packages offer add-ins as well as functions, and some are even add-ins only. One of my earliest favorite add-ins, Bare Combine, offers an elegant way to create R character vectors from plain text. Let’s say I’ve got text with the names of … anything that I’d like to turn into an R vector. Adding quotation marks around each item will quickly get annoying if there are more than a couple of entries. Hence the problem that Bare Combine aims to solve. You install addins the same way you install packages with install.packages() if they’re on CRAN, or whatever package and function you use to install from GitHub, Bitbucket and elsewhere if the version you want is somewhere else. You can find add-ins in RStudio’s Addins menu above the upper-left scripts pane. Sharon Machlis/IDG Addins menu in RStudio You can also search for add-ins by using the RStudio command palette, accessible with the keyboard shortcut ctrl-shift-P, or in the Tools > Addins > Browse Addins menu. Bare Combine is part of Bob Rudis’s hrbraddins on Bitbucket. You can install the full package with remotes::install_bitbucket("hrbrmstr/hrbraddins"). A number of add-ins should now be callable from RStudio. If you paste a comma-separated list of words into RStudio such as Chrome, Firefox, Safari, Internet Explorer, Edge, Opera and then highlight it and click on the Bare Combine addin form the menu, the result will be code for a properly formatted R vector: c("Chrome", "Firefox", "Safari", "Internet Explorer", "Edge", "Opera") It even works if the items aren’t comma-separated but are each on a separate line. It’s somewhat cumbersome and time-consuming to scroll through a list of addins, though. Fortunately, you can create a keyboard shortcut for any addin choosing Tools > Modify Keyboard Shortcuts in RStudio. You first see all the built-in possibilities for shortcuts. If you keep scrolling, you eventually see your addins. Or, much easier, you can use the search box to look for your addin. Click into the empty field under the Shortcut column and type your key combination. Here, I chose Ctrl-Alt-C (and next clicked Apply): Sharon Machlis/IDG Adding a custom keyboard shortcut in RStudio Now if I select the text and press Ctrl-Alt-C, my addin works—without having to scroll through my entire addin menu. Dean Attali has a list of RStudio addins on GitHub. It’s worth taking a look at the list; there might be a couple of addins you didn’t know about that will help you speed up your R workflow. Another of my favorites: datapasta by Miles McBain, which lets you copy data into your clipboard and then paste it into RStudio as a data frame. Related content feature 14 great preprocessors for developers who love to code Sometimes it seems like the rules of programming are designed to make coding a chore. Here are 14 ways preprocessors can help make software development fun again. By Peter Wayner Nov 18, 2024 10 mins Development Tools Software Development feature Designing the APIs that accidentally power businesses Well-designed APIs, even those often-neglected internal APIs, make developers more productive and businesses more agile. By Jean Yang Nov 18, 2024 6 mins APIs Software Development news Spin 3.0 supports polyglot development using Wasm components Fermyon’s open source framework for building server-side WebAssembly apps allows developers to compose apps from components created with different languages. By Paul Krill Nov 18, 2024 2 mins Microservices Serverless Computing Development Libraries and Frameworks news Go language evolving for future hardware, AI workloads The Go team is working to adapt Go to large multicore systems, the latest hardware instructions, and the needs of developers of large-scale AI systems. By Paul Krill Nov 15, 2024 3 mins Google Go Generative AI Programming Languages Resources Videos