Reader small image

You're reading from  Learning R Programming

Product typeBook
Published inOct 2016
Reading LevelBeginner
PublisherPackt
ISBN-139781785889776
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Kun Ren
Kun Ren
author image
Kun Ren

Kun Ren has used R for nearly 4 years in quantitative trading, along with C++ and C#, and he has worked very intensively (more than 8-10 hours every day) on useful R packages that the community does not offer yet. He contributes to packages developed by other authors and reports issues to make things work better. He is also a frequent speaker at R conferences in China and has given multiple talks. Kun also has a great social media presence. Additionally, he has substantially contributed to various projects, which is evident from his GitHub account: https://github.com/renkun-ken https://cn.linkedin.com/in/kun-ren-76027530 http://renkun.me/ http://renkun.me/formattable/ http://renkun.me/pipeR/ http://renkun.me/rlist/
Read more about Kun Ren

Right arrow

Chapter 15. Boosting Productivity

In the previous chapter, we learned to use R to extract information from web pages. To understand how this works, we learned several languages such as HTML, CSS, and XPath. In fact, R has much more to offer than just a statistical computing environment. The R community provides tools for everything from data collection, to data manipulation, statistical modeling, visualization, and all the way to reporting and presentation.

In this chapter, we will learn about a number of packages that boost our productivity. We'll review several languages we learned throughout this book and get to know another one: markdown. We'll see how R and markdown can be combined to produce powerful dynamic documents. More specifically, we'll:

  • Get to know markdown and R Markdown

  • Embed tables, charts, diagrams and interactive plots

  • Create interactive apps

Writing R Markdown documents


The work of data analysts is more than putting data into models and drawing some conclusions. We usually need to go through a complete workflow from data collecting, to data cleaning, visualization, modeling, and finally writing a report or making a presentation.

In the previous chapters, we improved our productivity by learning the R programming language from different aspects. In this chapter, we will further boost our productivity by focusing on the final step: reporting and presentation. In the following sections, we'll learn a very simple language to write documents: markdown.

Getting to know markdown

Throughout this book, we have already learned a bunch of languages. These languages are very different and may confuse beginners. But if you keep in mind their purposes, it won't be hard to use them together. Before learning markdown, we'll take a quick review of the languages we learned in the previous chapters.

The first is, of course, the R programming language...

Creating interactive apps


In the previous section, we demonstrated the use of R Markdown that is designed for creating dynamic documents. In this section, we will take a quick tour of creating interactive apps where we use a graphical user interface to interact with the data.

Creating a shiny app

R itself is a great environment for data analysis and visualization. However, it is not usual to deliver R and some analytic scripts to the customers to run by themselves. The outcome of data analysis can be presented not only in a HTML page, PDF document, or a Word document, but also in an interactive app that allows readers to interact with the data by modifying some parameters and see what happens with the outcome.

A powerful package, shiny (http://shiny.rstudio.com/), developed by RStudio, is designed exactly for this purpose. A shiny app is different from the interactive graphics we demonstrated previously. It works in a web browser and the developer has all the say about what appears in the web...

Summary


In this chapter, we demonstrated the use of R Markdown to produce dynamic documents where tables, graphics, and interactive plots can be easily embedded. Then we saw a few simple examples of shiny apps which are basically web-based interactive apps with an R backend. With these powerful productivity tools, data analysis can be made more interesting and full of fun because the outcome can be demonstrated in a nice, interactive way, which is usually better for conveying more information, drawing more insights and making better decisions.

Now we have finished this book. We started learning R by getting familiar with the fundamental concepts, data structures and language constructs and features. We went through a wide range of examples to understand how these fit the needs of practical data analysis. To build a concrete and consistent understanding of the R programming language and the behavior of data structures, we discussed several advanced topics such as R's evaluation model, metaprogramming...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learning R Programming
Published in: Oct 2016Publisher: PacktISBN-13: 9781785889776
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.
undefined
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 $15.99/month. Cancel anytime

Author (1)

author image
Kun Ren

Kun Ren has used R for nearly 4 years in quantitative trading, along with C++ and C#, and he has worked very intensively (more than 8-10 hours every day) on useful R packages that the community does not offer yet. He contributes to packages developed by other authors and reports issues to make things work better. He is also a frequent speaker at R conferences in China and has given multiple talks. Kun also has a great social media presence. Additionally, he has substantially contributed to various projects, which is evident from his GitHub account: https://github.com/renkun-ken https://cn.linkedin.com/in/kun-ren-76027530 http://renkun.me/ http://renkun.me/formattable/ http://renkun.me/pipeR/ http://renkun.me/rlist/
Read more about Kun Ren