Search icon CANCEL
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

Element selection

Let's now examine how elements can be selected from various class features.

Selecting elements from vectors

At this point in the chapter, you probably already suspect that in order to select specific items from a vector, the selection condition must be enclosed in [].

There are basically three ways of selecting elements from arrays in R. They are as follows:

  1. By index: A set of integers that indicate the position of the elements to select:
    > LETTERS[c(1,5,6)]
    [1] "A" "E" "F"
    

    Note

    LETTERS is a character vector built-in object in R that contains the entire alphabet in upper case. For lower case, use LETTERS.

    Using negative subscripts removes specific elements from an object (unlike in languages such as Python, where it implies reverse order):

    > LETTERS[-c(1,5,6)]
    [1] "B" "C" "D" "G" "H" "I" "J" "K" "L" "M" "N" "O" &quot...
lock icon The rest of the chapter is locked
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