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
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

Basic summary functions


In this section, table() and aggregate() will be covered. They are basic processing functions that come in the base package.

  • table(): This creates a contingency table with the specified vectors. Although its output is of the table type, it works similar to an array:

    sample.data <-data.frame(var1 =rep(c("Male","Female"),10), var2 =rep(c("A","B","C","D")))
    example.table<-table(sample.data$var1, sample.data$var2)
    example.table
    ##         
    ##          A B C D
    ##   Female 0 5 0 5
    ##   Male   5 0 5 0
    example.table[2,2]
    ## [1] 0
    

    The output of table() can be indexed in the same way as an array.

  • aggregate(): This performs one or more functions over a vector split by a factor variable. aggregate() has basically two ways of usage:

    • With vectors: One or more vectors are passed to the x argument while one or more factor vectors are passed in the by argument. FUN is the aggregation function to be used:

      > data(iris)
      > aggregate(iris$Sepal.Length, by=list(iris$Species...
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
Banner background image