Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
R High Performance Programming

You're reading from  R High Performance Programming

Product type Book
Published in Jan 2015
Publisher
ISBN-13 9781783989263
Pages 176 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

R High Performance Programming
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Understanding R's Performance – Why Are R Programs Sometimes Slow? Profiling – Measuring Code's Performance Simple Tweaks to Make R Run Faster Using Compiled Code for Greater Speed Using GPUs to Run R Even Faster Simple Tweaks to Use Less RAM Processing Large Datasets with Limited RAM Multiplying Performance with Parallel Computing Offloading Data Processing to Database Systems R and Big Data Index

Use of built-in functions


As a programming language, R comes with low-level operators, such as basic arithmetic operators that can be used to construct more complex operators or functions. While R provides the flexibility to define functions, a performance comparison between an R function versus an equivalent function in a compiled language would almost always favor the latter. However, R and some CRAN packages provide a rich set of functions that are implemented in compiled languages such as C/C++. It is usually preferable to use these functions rather than to write custom R functions to perform the same task.

Consider a simple example of how to calculate the sums of the rows of the following random matrix data. A code to perform these functions can be constructed by calling the apply() function, and setting the margin to 1 (representing a row operation) and by setting the FUN (or function) argument to sum. Alternatively, R provides a built-in function for this purpose called rowSums. The...

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 $15.99/month. Cancel anytime}