Top 5 Tips for RStudio (Posit) Workbench and Desktop

Estimated time:

RStudio recently announced the renaming of RStudio <del>Server Pro</del> to RStudio Workbench (Posit Workbench). Along with the relabel, some <a href="" target="_blank" rel="noopener noreferrer">updates and new features</a> were added. In this blog, we will discuss our 5 favorite tips for more efficient use of RStudio Workbench (also applicable for RStudio Desktop). Note: At the time of writing this article, Posit PBC was RStudio PBC. We use RStudio and Posit interchangeably in this text (e.g. RStudio Workbench == Posit Workbench). <ul><li><a href="#anchor-1" target="_blank" rel="noopener noreferrer">R</a></li><li><a href="#anchor-2" target="_blank" rel="noopener noreferrer">RStudio</a><ul><li><a href="#anchor-3" target="_blank" rel="noopener noreferrer">1) Shortcuts</a></li><li><a href="#anchor-4" target="_blank" rel="noopener noreferrer">2) Multi-Column View</a></li><li><a href="#anchor-5" target="_blank" rel="noopener noreferrer">3) Finding Functions &amp; Variables</a></li><li><a href="#anchor-6" target="_blank" rel="noopener noreferrer">4) Multi-Cursor Editing</a></li><li><a href="#anchor-7" target="_blank" rel="noopener noreferrer">5) Investigate Function Source Code &amp; Documentation</a></li></ul> <h2 id="anchor-1">R</h2> R is a free software environment for statistical computing and graphics. It compiles and runs on a variety of UNIX platforms, Windows, and MacOS. It supports a wide range of packages that implement a variety of algorithms and tools for data scientists, data analysts, data engineers, statisticians, and business analysts. <h2 id="anchor-2">RStudio IDE</h2> RStudio is a free and open-source IDE (Integrated Development Environment) for R. RStudio’s GUI (Graphical User Interface) makes it easy for a coder to navigate various parts of a project like viewing graphs, data tables, R code, and output simultaneously. The developer can manage git, database connections, files and directories, R packages, and more from within RStudio. With RStudio, one can also publish a shiny dashboard to the web on shinyapps or RStudio Connect. While the IDE is already intuitive and easy to use, becoming an expert in RStudio will greatly improve the speed and efficiency of your software development. Here, we look at five tips that will make your day-to-day development tasks more efficient. <blockquote><strong>Appsilon is a proud <a href="" target="_blank" rel="noopener noreferrer">RStudio Full Service Partner</a>. Discover how we can help you succeed with R and RStudio. </strong></blockquote> <h3 id="anchor-3">1) Shortcuts</h3> In day-to-day programming, we repeatedly execute several actions (e.g., restarting the R session, creating a function, or running an R Shiny application). While there are GUI elements to perform these tasks, it can be more convenient and efficient to use shortcuts. Here are some of the most useful shortcuts on RStudio: <img class="aligncenter wp-image-7672 size-full" src="" alt="" width="1024" height="768" /> &nbsp; <blockquote><strong>Check out our blog more <a href="" target="_blank" rel="noopener noreferrer">RStudio Shortcuts and Tips</a></strong></blockquote> <img class="aligncenter size-full wp-image-7663" src="" alt="" width="1024" height="768" /> &nbsp; <h4>Usage</h4> Apart from adding comments, commenting and uncommenting shortcuts can be used as a quick way to turn on and turn off parts of the code while experimenting and iterating with the code. The various panels can be navigated with the Ctrl + &lt;Number&gt; shortcuts. Quickly add documents, and then when the save all documents shortcut is pressed, RStudio will prompt the user to save the new file with a name. Running the whole document can also be used as Run App for R Shiny Apps when the Run App icon is active. <h3 id="anchor-4">2) Multi-Column View</h3> RStudio has recently introduced an awesome feature. We can now have 3 additional columns (for a total of 5) to the layout of RStudio. This is helpful as we often work with multiple documents in the project. This way, we can have more than one document open, keeping all other views intact. <img class="aligncenter size-full wp-image-7644" src="" alt="RStudio IDE column view" width="1600" height="1000" /> <b>RStudio with 5 columns</b> To add more columns to RStudio follow these steps: <ul><li style="list-style-type: none;"><ul><li style="list-style-type: none;"><ol><li style="font-weight: 400;" aria-level="1">Click on “Tools” from the menu bar at the top</li><li style="font-weight: 400;" aria-level="1">In the dropdown, click on “Global Options”</li><li style="font-weight: 400;" aria-level="1">On the pop-up, click on “Pane Layout” tab of the left sidebar</li><li style="font-weight: 400;" aria-level="1">Now “Add Columns” or “Remove Columns” as needed</li></ol></li></ul> </li> </ul> <h3 id="anchor-5">3) Finding Functions &amp; Variables</h3> Often, we need to find where functions or variables are used. Vice-versa, we look for function and variable definitions across the entire project. RStudio has the combined ability to search within a file as well as across all files in the working directory. It is also possible to quickly open a file in the working directory by searching for filename or function name. This helps us quickly track a function or variable across multiple documents in the project. Combine the three shortcuts below to quickly trace a function or variable. <img class="aligncenter size-full wp-image-7661" src="" alt="" width="1024" height="768" /> &nbsp; <h3 id="anchor-6">4) Multi-Cursor Editing</h3> RStudio natively supports multi-cursor functionality. That means it is possible to have multiple cursors concurrently in different parts of the code and edit them all simultaneously. There are shortcuts for faster editing using this functionality. For example, when a variable change is needed but within the scope of the function or file. And a change is needed to all names of the variable within that function, including in the argument list. This is possible with the second shortcut below. <img class="aligncenter size-full wp-image-7664" src="" alt="" width="1024" height="768" /> <blockquote><strong>5 Tips for <a href="" target="_blank" rel="noopener noreferrer">Writing Clean R Code</a></strong></blockquote> &nbsp; <p style="text-align: center;"><b>Ctrl/Cmd + Click/Click &amp; Drag</b></p> <img class="aligncenter size-full wp-image-7642" src="" alt="Click and drag cursor editing" width="512" height="256" /> <p style="text-align: center;"><b>Ctrl/Cmd + Alt/Option + Shift + M</b></p> <img class="aligncenter size-full wp-image-7643" src="" alt="Ctrl+alt+shift+M" width="408" height="512" /> These are very useful in code refactoring, code cleanup, tracking variables within a scope, finding &amp; replacing variables in the scope, adding repetitive code snippets quickly, etc. <h3 id="anchor-7">5) Investigate Function Source Code &amp; Documentation</h3> In Microsoft Excel and Google Sheets, you can press F2 to show the formula and cells involved. Similarly, in RStudio, by pressing F2 or on mac fn + F2, it is possible to dig into the source code of any function. This action permits a quick investigation of the source code of any function in our R code. Place the cursor on the function name where used. Pressing F2 (fn + F2 in mac) will open up the source code of that function. To quickly open the function documentation, we can press F1 (fn + F1 in mac), and the built-in documentation for the function will open up in the “Help” pane at the bottom right of the screen. <img class="aligncenter size-full wp-image-7662" src="" alt="" width="1024" height="768" /> &nbsp; <h2 id="anchor-8">Summing up RStudio (Posit) Workbench Tips</h2> These useful functionalities are the little bonuses that make RStudio a great tool to pre-process and analyze data - and build algorithms, dashboards, and applications. They make it simple to manage git repositories, packages, and code, including functions and variables. It will also help in developing and iterating faster and building more durable applications and algorithms. <h2>Let’s Build Something Beautiful Together</h2> Appsilon provides innovative <strong>data</strong> <strong>analytics</strong>, <strong>machine</strong> <strong>learning</strong>, and <strong>managed services </strong>solutions for Fortune 500 companies, NGOs, and non-profit organizations. We deliver <strong>the world’s most advanced <a class="gmail-QuillHelpers-link gmail-textEditor-link" href="" target="_blank" rel="nofollow noopener noreferrer">R Shiny</a> applications</strong>, with a unique ability to rapidly develop and scale enterprise Shiny dashboards. Our proprietary machine learning frameworks allow us to deliver <strong><a href="">Computer Vision</a></strong>, <strong>NLP</strong>, and <strong>fraud detection</strong> prototypes in as little as one week. Discover our growing list of open-source R Shiny packages at <a href="" target="_blank" rel="noopener noreferrer"></a>. If you find our open-source packages useful, please consider dropping a star on your favorites at our <a href="" target="_blank" rel="noopener noreferrer">Github</a>. It helps let us know we’re on the right track. And if you have any comments or suggestions, swing by our feedback threads like the discussion at our new <a href="" target="_blank" rel="noopener noreferrer">shiny.fluent package</a> or submit a pull request. We value the R community’s input. <a href="" target="_blank" rel="noopener noreferrer"><img class="aligncenter size-full wp-image-7584" src="" alt="world class enterprise Shiny dashboards" width="1914" height="880" /></a></li> </ul>

Contact us!
Damian's Avatar
Iwona Matyjaszek
Head of Sales
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Have questions or insights?
Engage with experts, share ideas and take your data journey to the next level!
Join Slack
Explore Possibilities

Take Your Business Further with Custom Data Solutions

Unlock the full potential of your enterprise with our data services, tailored to the unique needs of Fortune 500 companies. Elevate your strategy -connect with us today!

Talk to our Experts