09.09.2016 Views

SAP HANA R Integration Guide

2c9H5is

2c9H5is

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

●<br />

●<br />

●<br />

●<br />

Input to R only required data.<br />

Predefine right-sized data structures and fill them, rather than appending new elements (which involves<br />

more expensive copy operations).<br />

Vectorize calculations, avoid iterations.<br />

○<br />

Use apply() and the plyr package instead of loops.<br />

○ See http://nsaunders.wordpress.com/2010/08/20/a-brief-introduction-to-apply-in-r .<br />

○ See http://www.r-project.org/doc/Rnews/Rnews_2008-1.pdf .<br />

Avoid unnecessary character creation operations, for example:<br />

USE.NAMES=FALSE in sapply, use.names=FALSE in unlist<br />

●<br />

●<br />

Use appropriate functions, often from specialized packages.<br />

Identify appropriate algorithms, for example, the intrinsic %in% operation is O(N), whereas coding this<br />

operation in R code might have a cost of O(N 2 ).<br />

8<br />

P U B L I C<br />

© 2016 <strong>SAP</strong> SE or an <strong>SAP</strong> affiliate company. All rights reserved.<br />

<strong>SAP</strong> <strong>HANA</strong> R <strong>Integration</strong> <strong>Guide</strong><br />

R and <strong>SAP</strong> <strong>HANA</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!