In this post we will look at yet another productivity increasing feature of the RStudio IDE - Code Snippets. Code Snippets let us easily insert and potentially execute predefined pieces of code and work not just for R code, but many other languages as well.
In this post we will cover 4 different ways to increase productivity using Code Snippets and provide 11 real-life examples of their use that you can take advantage of instantly.
In this post in the R:case4base series we will look at one of the most common operations on multiple data frames - merge, also known as JOIN in SQL terms.
We will learn how to do the 4 basic types of join - inner, left, right and full join with base R and show how to perform the same with tidyverse’s dplyr and data.table’s methods. A quick benchmark will also be included.
Inspired by a recent post on how to import a directory of csv files at once using purrr and readr by Garrick, in this post we will try achieving the same using base R with no extra packages, and with data·table, another very popular package and as an added bonus, we will play a bit with benchmarking to see which of the methods is the fastest, including the tidyverse approach in the benchmark.
RStudio version 1.1 introduced the Terminal functionality, which does not seem to be getting enough deserved attention and love even though it is very well integrated with the rest of the IDE and can be extremely useful for several daily use-cases.
In this post we will try to cover 4 very common scenarios where the Terminal can be very useful and productive, and how to get the most of it.
We all know that feeling. We have this great idea about a new project, feature, function, piece of code.
What do we want? Write that amazing new code! When do we want it? Right NOW!
The aim of this post is to try and give you at 3 good reasons to resist that urge and consider other options, be it in your business projects or your private projects.
Calling functions in R usually involves typing brackets. And since many of our actions in R involve calling a function, we will have to type a lot of brackets working with R. Often it would make our life a lot easier if we could omit the need to type brackets where convenient. We will do exactly that today.
Work in R faster with custom bracketless commands A good starting example is, well, quitting R altogether.
In this summertime post in the case4base series, we will look at useful tools in base R, which let us profile our code without any extra packages needed to be installed. We will cover simple and easy to use speed profiling, more complex profiling of performance and memory and, as always, look at alternatives to base R as well, with a special shout out to profiling integration in RStudio.
Profiling our code is a very useful tool to determine how well the code performs on different metrics.
The addin we will create in this article will let us use a keyboard shortcut to run profiling on R code selected in RStudio without blocking the session or requiring any external packages. Specifically for very simple overview use, it may be beneficial to look at the time needed for a set of expressions to compute, e.
A developer always pays his technical debts! And we have a debt to pay to the gods of coding best practices, as we did not present many unit tests for our functions yet. Today we will show how to efficiently investigate and improve unit test coverage for our R code, with focus on functions governing our RStudio addins, which have their own specifics.
As a practical example, we will do a simple resctructuring of one of our functions to increase its test coverage from a mere 34% to over 90%.
In this part of the primer we discuss creating and using custom .jar archives within our R scripts and packages, handling of Java exceptions from R and a quick look at performance comparison between the low and high-level interfaces provided by rJava.
In the first part we talked about using the rJava package to create objects, call methods and work with arrays, we examined the various ways to call Java methods and calling Java code from R directly via execution of shell commands.