Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying R High Performance Programming
  • Table Of Contents Toc
  • Feedback & Rating feedback
R High Performance Programming

R High Performance Programming

By : Aloysius Shao Qin Lim, Tjhi W Chandra
4.4 (14)
close
close
R High Performance Programming

R High Performance Programming

4.4 (14)
By: Aloysius Shao Qin Lim, Tjhi W Chandra

Overview of this book

This book is for programmers and developers who want to improve the performance of their R programs by making them run faster with large data sets or who are trying to solve a pesky performance problem.
Table of Contents (12 chapters)
close
close
11
Index

Using compiled languages in R

Code compilation can provide modest gains in computational performance, but there are limits to these gains because the compiled code still needs to be evaluated by R in a dynamic fashion. For example, we explained in Chapter 3, Simple Tweaks to Make R Run Faster, how R, being a dynamically typed language, needs to check the type of an object before applying any operations. In the case of mov.avg(), every time R encounters the + operator, it needs to check that x is a numeric vector, as it could have been modified between each iteration of the for loop. In contrast, a statically typed language performs these checks at compile time, resulting in much faster run time performance.

For this and many other reasons, R's dynamic nature poses barriers to computational performance. The only way to break through these barriers is to turn to compiled languages such as C and use them from within R. This section assumes that you have some basic knowledge of compiled...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY