This book provides R recipes for asset allocation and portfolio optimization problems. After introducing all the necessary probabilistic and statistical foundations, the author moves on to topics related to asset allocation and portfolio optimization with R codes illustrated for various examples. This book consists of six chapters. Chapter 1 provides an introduction, which covers financial engineering, using R in data analysis, and univariate, bivariate, and multivariate data analysis. Chapter 2 examines probabilistic calculus for modeling financial engineering. This chapter walks the reader through building an effective financial model from GBM via probalistic calculus, and also covers Ito Calculus. Chapter 3 describes classical mathematical models in financial engineering and modern portfolio theory. The Two Mutual Fund Theorem and The Sharpe Ratio are discussed. R as a calculator and using R in data analysis in financial engineering are the topics of Chapter 4. Next, Chapter 5 covers assets allocation using R. Finally, Chapter 6 examines financial risk modeling and portfolio optimization using R. In this chapter, the author discusses global and local optimal values, locating functional maxima and minima, and also portfolio optimization by performance analytics in CRAN.