title: Custom expected returns in the Portfolio Analytics package
body: <p>I have trouble incorporating custom expected returns in Portfolio Analytics package. Usually expected returns are some professional expectations / views or calculated separately from fundamental indicators. Portfolio Analytics allow to create custom moments function to calculate moments from past returns, but I don't understand how to incorporate already calculated returns to optimization problem. Any help is appreciated and here is small example dataset:</p>
  
  <pre><code>#Download package and sample returns
  library(PortfolioAnalytics) 
  library(PerformanceAnalytics)
  data(edhec)
  returns &lt;- tail(edhec[,1:4], 10)
  
  #Example expected return xts that I'm usually working with. Calculated separately.
  N &lt;- 10
  M &lt;- 4
  views &lt;- as.xts(data.frame(matrix(rnorm(N*M,mean=0,sd=0.05), N, M)), order.by = index(returns))
  colnames(views) &lt;- colnames(returns)
  </code></pre>
  
  <p>Lets create basic portfolio with some objectives.</p>
  
  <pre><code>pf &lt;- portfolio.spec(assets = colnames(returns))
  pf &lt;- add.constraint(portfolio = pf, type = "full_investment")
  pf &lt;- add.constraint(portfolio = pf, type = "long_only")
  pf &lt;- add.objective(portfolio = pf, type = "return", name = "mean")
  pf &lt;- add.objective(portfolio = pf, type = "risk", name = "StdDev")
  </code></pre>
  
  <p>Now I would like to optimize portfolio pf at each period and take account views (expected returns for that period) but I'm running out of ideas at this point.</p>