Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Shiny

You're reading from   Learning Shiny Make the most of R's dynamic capabilities and implement web applications with Shiny

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781785280900
Length 246 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Hernan Resnizky Hernan Resnizky
Author Profile Icon Hernan Resnizky
Hernan Resnizky
Hernan Resnizky Hernan Resnizky
Author Profile Icon Hernan Resnizky
Hernan Resnizky
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introducing R, RStudio, and Shiny FREE CHAPTER 2. First Steps towards Programming in R 3. An Introduction to Data Processing in R 4. Shiny Structure – Reactivity Concepts 5. Shiny in Depth – A Deep Dive into Shiny's World 6. Using R's Visualization Alternatives in Shiny 7. Advanced Functions in Shiny 8. Shiny and HTML/JavaScript 9. Interactive Graphics in Shiny 10. Sharing Applications 11. From White Paper to a Full Application Index

About RStudio

As with other programming languages, there is a huge variety of IDEs available for R. IDEs are applications that make code development easier and clearer for the programmer. RStudio is one of the most important ones for R, and it is especially recommended to write web applications in R with Shiny because this contains features specially designed for this purpose. Additionally, RStudio provides facilities to write C++, Latex, or HTML documents and also integrates them to the R code.

RStudio also provides version control, project management, and debugging features among many others.

Installing RStudio

RStudio for desktop computers can be downloaded from its official website at http://www.rstudio.com/products/rstudio/download/ where you can get versions of the software for Windows, MAC OS X, Ubuntu, Debian, and Fedora.

A quick guide to RStudio

Before installing and running RStudio, it is important to have R installed. As it is an IDE and not the programming language, it will not work at all. The following screenshot shows RStudio's starting view:

A quick guide to RStudio

At the first glance, the following four main windows are available:

  • Text editor: This provides facilities to write R scripts such as highlighting and a code completer (when hitting Tab, you can see the available options to complete the code written). It is also possible to include R code in an HTML, Latex, or C++ piece of code.
  • Environment and history: They are defined as follows:
    • In the Environment section, you can see the active objects in each environment. By clicking on Global Environment (which is the environment shown by default), you can change the environment and see the active objects. You can find more information about environments in a chapter dedicated to this topic in the book Advanced R, by Hadley Wickham. It is available at http://adv-r.had.co.nz/Environments.html.
    • In the History tab, the pieces of codes executed are stored line by line. You can select one or more lines and send them either to the editor or to the console. In addition, you can look up for a certain specific piece of code by typing it in the textbox in the top right part of this window.
  • Console: This is an exact equivalent of R console, as described in Quick guide of R.
  • Tabs: The different tabs are defined as follows:
    • Files: This consists of a file browser with several additional features (renaming, deleting, and copying). Clicking on a file will open it in editor or the Environment tab depending on the type of the file. If it is a .rda or .RData file, it will open in both. If it is a text file, it will open in one of them.
    • Plots: Whenever a plot is executed, it will be displayed in that tab.
    • Packages: This shows a list of available and active packages. When the package is active, it will appear as clicked. Packages can also be installed interactively by clicking on Install Packages.
    • Help: This is a window to seek and read active packages' documentation.
    • Viewer: This enables us to see the HTML-generated content within RStudio.

Along with numerous features, RStudio also provides keyboard shortcuts. A few of them are listed as follows:

Description

Windows/Linux

OSX

Complete the code.

Tab

Tab

Run the selected piece of code. If no piece of code is selected, the active line is run.

Ctrl + Enter

⌘ + Enter

Comment the selected block of code.

Ctrl + Shift + C

⌘ + /

Create a section of code, which can be expanded or compressed by clicking on the arrow to the left. Additionally, it can be accessed by clicking on it in the bottom left menu.

#####

#####

Find and replace.

Ctrl + F

⌘ + F

The following screenshots show how a block of code can be collapsed by clicking on the arrow and how it can be accessed quickly by clicking on its name in the bottom-left part of the window:

A quick guide to RStudio

Clicking on the circled arrow will collapse the Section 1 block, as follows:

A quick guide to RStudio

The full list of shortcuts can be found at https://support.rstudio.com/hc/en-us/articles/200711853-Keyboard-Shortcuts.

Note

For further information about other RStudio features, the full documentation is available at https://support.rstudio.com/hc/en-us/categories/200035113-Documentation.

You have been reading a chapter from
Learning Shiny
Published in: Oct 2015
Publisher:
ISBN-13: 9781785280900
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image