Book Image

R Data Analysis Cookbook

By : Viswa Viswanathan, Shanthi Viswanathan
Book Image

R Data Analysis Cookbook

By: Viswa Viswanathan, Shanthi Viswanathan

Overview of this book

<p>Data analytics with R has emerged as a very important focus for organizations of all kinds. R enables even those with only an intuitive grasp of the underlying concepts, without a deep mathematical background, to unleash powerful and detailed examinations of their data.</p> <p>This book empowers you by showing you ways to use R to generate professional analysis reports. It provides examples for various important analysis and machine-learning tasks that you can try out with associated and readily available data. The book also teaches you to quickly adapt the example code for your own needs and save yourself the time needed to construct code from scratch.</p>
Table of Contents (18 chapters)
R Data Analysis Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 9. Work Smarter, Not Harder – Efficient and Elegant R Code

In this chapter, we will cover recipes for doing the following without explicit iteration:

  • Exploiting vectorized operations

  • Processing entire rows or columns using the apply function

  • Applying a function to all elements of a collection with lapply and sapply

  • Applying functions to subsets of a vector

  • Using the split-apply-combine strategy with plyr

  • Slicing, dicing, and combining data with data tables